From 2497c100de34c113304227f72015bfb3755854a3 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 30 Jul 2010 21:35:29 +0200 Subject: daily commit --- module/ThreadManager.py | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'module/ThreadManager.py') 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) + + -- cgit v1.2.3