Wait 0.1s for new tasks before shut down worker
This commit is contained in:
parent
60af54a17e
commit
027ee83c6f
1 changed files with 6 additions and 3 deletions
|
@ -28,7 +28,10 @@ class Worker(object):
|
||||||
while self.running:
|
while self.running:
|
||||||
# Try to pickup free file download task
|
# Try to pickup free file download task
|
||||||
task = self.manager.getTask(self.peer)
|
task = self.manager.getTask(self.peer)
|
||||||
if not task: # Die, no more task
|
if not task: # No more task
|
||||||
|
time.sleep(0.1) # Wait a bit for new tasks
|
||||||
|
task = self.manager.getTask(self.peer)
|
||||||
|
if not task: # Still no task, stop it
|
||||||
self.manager.log.debug("%s: No task found, stopping" % self.key)
|
self.manager.log.debug("%s: No task found, stopping" % self.key)
|
||||||
break
|
break
|
||||||
if not task["time_started"]:
|
if not task["time_started"]:
|
||||||
|
|
Loading…
Reference in a new issue