diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-07-30 21:35:29 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-07-30 21:35:29 +0200 |
commit | 2497c100de34c113304227f72015bfb3755854a3 (patch) | |
tree | e382f92368a37d623f5aea5d02609a13a1c338d8 /module/ThreadManager.py | |
parent | restart working and client information (diff) | |
download | pyload-2497c100de34c113304227f72015bfb3755854a3.tar.xz |
daily commit
Diffstat (limited to 'module/ThreadManager.py')
-rw-r--r-- | module/ThreadManager.py | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/module/ThreadManager.py b/module/ThreadManager.py index 67ea0d8d8..5186c189e 100644 --- a/module/ThreadManager.py +++ b/module/ThreadManager.py @@ -68,7 +68,7 @@ class ThreadManager: self.checkReconnect() self.checkThreadCount() - self.assingJob() + self.assignJob() #---------------------------------------------------------------------- def checkReconnect(self): @@ -89,24 +89,37 @@ class ThreadManager: #---------------------------------------------------------------------- - def assingJob(self): + def assignJob(self): """assing a job to a thread if possible""" if self.pause: return free = [x for x in self.threads if not x.active] + + - if free: - thread = free[0] - - occ = [x.active.pluginname for x in self.threads if x.active and not x.active.plugin.multiDL ] - occ.sort() - occ = set(occ) - job = self.core.files.getJob(tuple(occ)) - if job: + occ = [x.active.pluginname for x in self.threads if x.active and not x.active.plugin.multiDL ] + occ.sort() + occ = set(occ) + job = self.core.files.getJob(tuple(occ)) + if job: + try: job.initPlugin() - thread.put(job) - + except Exception, e: + self.log.critical(str(e)) + + if job.plugin.__type__ == "hoster": + if free: + thread = free[0] + thread.put(job) + else: + #put job back + self.core.files.jobCache[occ].append(job.id) + + else: + thread = PluginThread.DecrypterThread(job) + + |