diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2014-01-20 00:06:53 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2014-01-20 00:06:53 +0100 |
commit | 9b53c239a9b867ba3dc3fc94ac02fa4cb30bd5b3 (patch) | |
tree | 7094045f649ca1a118f2030591002afa9d2e3a43 | |
parent | fixes for download scheduler #3 (diff) | |
download | pyload-9b53c239a9b867ba3dc3fc94ac02fa4cb30bd5b3.tar.xz |
fixes for download scheduler #4
-rw-r--r-- | pyload/DownloadManager.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pyload/DownloadManager.py b/pyload/DownloadManager.py index 4d8ad520f..f014ab776 100644 --- a/pyload/DownloadManager.py +++ b/pyload/DownloadManager.py @@ -200,7 +200,7 @@ class DownloadManager: def chooseJobs(self, jobs, k): """ make a fair choice of which k jobs to start """ # TODO: prefer admins, make a fairer choice? - if k <= 0 or k: return [] + if k <= 0: return [] if k >= len(jobs): return jobs return sample(jobs, k) @@ -291,7 +291,7 @@ class DownloadManager: @read_lock def getRemainingPluginSlots(self): """ dict of plugin names mapped to remaining dls """ - occ = defaultdict(lambda: -1) + occ = {} # decrypter are treated as occupied for p in self.decrypter: progress = p.getProgress() @@ -302,8 +302,8 @@ class DownloadManager: for t in self.working: if not t.active.hasPlugin(): continue limit = t.active.plugin.getDownloadLimit() - # limit < 0 means no limit - occ[t.active.pluginname] = limit if limit >= 0 else float('inf') + # limit <= 0 means no limit + occ[t.active.pluginname] = limit if limit > 0 else float('inf') # subtract with running downloads for t in self.working: |