diff options
author | mkaay <mkaay@mkaay.de> | 2010-11-05 18:29:42 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-11-05 18:29:42 +0100 |
commit | 7fababff0fb3e4251cf7ac60f7a945a9e8f13bde (patch) | |
tree | b688b51493e5ac4418305b034676ab1c20e6c2f7 /module/ThreadManager.py | |
parent | sj fix (diff) | |
download | pyload-7fababff0fb3e4251cf7ac60f7a945a9e8f13bde.tar.xz |
scheduler optimization, SJOrg fix, better crypter limit
Diffstat (limited to 'module/ThreadManager.py')
-rw-r--r-- | module/ThreadManager.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/module/ThreadManager.py b/module/ThreadManager.py index d17281e9d..a2a8b0411 100644 --- a/module/ThreadManager.py +++ b/module/ThreadManager.py @@ -63,21 +63,21 @@ class ThreadManager: #---------------------------------------------------------------------- def addOccupiedCrypter(self, name): self.occupiedCrypterLock.acquire() - if not name in self.occupiedCrypter: - self.occupiedCrypter.append(name) - print True + self.occupiedCrypter.append(name) self.occupiedCrypterLock.release() def removeOccupiedCrypter(self, name): self.occupiedCrypterLock.acquire() if name in self.occupiedCrypter: - print True self.occupiedCrypter.remove(name) self.occupiedCrypterLock.release() def isOccupiedCrypter(self, name): self.occupiedCrypterLock.acquire() - ret = name in self.occupiedCrypter + ret = 0 + for plugin in self.occupiedCrypter: + if name == plugin: + ret += 1 self.occupiedCrypterLock.release() return ret @@ -253,11 +253,19 @@ class ThreadManager: job = self.core.files.getDecryptJob() if job: job.initPlugin() - thread = PluginThread.DecrypterThread(self, job) + if job.plugin.multiDL or self.isOccupiedCrypter(job.pluginname) < job.plugin.limitDL: + thread = PluginThread.DecrypterThread(self, job) + if not job.plugin.multiDL: + print "add" + self.addOccupiedCrypter(job.pluginname) else: - thread = PluginThread.DecrypterThread(self, job) + if job.plugin.multiDL or self.isOccupiedCrypter(job.pluginname) < job.plugin.limitDL: + thread = PluginThread.DecrypterThread(self, job) + if not job.plugin.multiDL: + print "add" + self.addOccupiedCrypter(job.pluginname) def cleanup(self): """do global cleanup""" |