From df0e93c878c2f6cf1c914516a7c754edfea7d3ce Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 7 Oct 2010 18:47:34 +0200 Subject: files.mail.ru closed #101 --- module/ThreadManager.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'module/ThreadManager.py') diff --git a/module/ThreadManager.py b/module/ThreadManager.py index 73e9efe56..6d7171222 100644 --- a/module/ThreadManager.py +++ b/module/ThreadManager.py @@ -165,19 +165,23 @@ class ThreadManager: pass + def cleanPyCurl(self): + if self.downloadingIds() or self.processingIds(): + return False + pycurl.global_cleanup() + pycurl.global_init(pycurl.GLOBAL_DEFAULT) + self.downloaded = 0 + self.log.debug("Cleaned up pycurl") + return True + #---------------------------------------------------------------------- def assignJob(self): """assing a job to a thread if possible""" if self.pause or not self.core.server_methods.is_time_download(): return - if self.downloaded > 20: - if self.downloadingIds() or self.processingIds(): - return - pycurl.global_cleanup() - pycurl.global_init(pycurl.GLOBAL_DEFAULT) - self.downloaded = 0 - self.log.debug("Cleaned up pycurl") + #if self.downloaded > 20: + # if not self.cleanPyCurl(): return free = [x for x in self.threads if not x.active] -- cgit v1.2.3