diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2014-01-19 23:52:31 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2014-01-19 23:52:31 +0100 |
commit | e8c4ba502126e586b4a1c26a9e15e1d562d3bc8f (patch) | |
tree | c6513e9ddf390767f5d1ca7b736fb7f5e95e704e | |
parent | fixes for download scheduler #2 (diff) | |
download | pyload-e8c4ba502126e586b4a1c26a9e15e1d562d3bc8f.tar.xz |
fixes for download scheduler #3
-rw-r--r-- | pyload/DownloadManager.py | 8 | ||||
-rw-r--r-- | pyload/threads/DownloadThread.py | 1 |
2 files changed, 3 insertions, 6 deletions
diff --git a/pyload/DownloadManager.py b/pyload/DownloadManager.py index 0c3294752..4d8ad520f 100644 --- a/pyload/DownloadManager.py +++ b/pyload/DownloadManager.py @@ -191,8 +191,6 @@ class DownloadManager: # we know exactly the number of remaining jobs # or only can start one job if limit is not known to_schedule = slots[plugin] if plugin in slots else 1 - # -1 means no limit - to_schedule = len(jobs) if to_schedule == -1 else to_schedule # start all chosen jobs for job in self.chooseJobs(jobs, to_schedule): # if the job was started the limit will be reduced @@ -202,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: return [] + if k <= 0 or k: return [] if k >= len(jobs): return jobs return sample(jobs, k) @@ -304,8 +302,8 @@ class DownloadManager: for t in self.working: if not t.active.hasPlugin(): continue limit = t.active.plugin.getDownloadLimit() - if limit < 0: continue - occ[t.active.pluginname] = limit + # 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: diff --git a/pyload/threads/DownloadThread.py b/pyload/threads/DownloadThread.py index 9ce3a9e0d..df2a59f8f 100644 --- a/pyload/threads/DownloadThread.py +++ b/pyload/threads/DownloadThread.py @@ -191,7 +191,6 @@ class DownloadThread(BaseThread): continue - except Exception, e: if isinstance(e, ResponseException) and e.code == 500: pyfile.setStatus("temp. offline") |