Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
result work not block
Browse files Browse the repository at this point in the history
  • Loading branch information
binux committed Nov 11, 2014
1 parent d74ec5e commit 77c2d5f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions result/result_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ def on_result(self, task, result):
assert 'url' in task, 'need url in task'
return self.resultdb.save(project=task['project'], taskid=task['taskid'], url=task['url'], result=result)

def quit(self):
self._quit = True

def run(self):
while not self._quit:
try:
task, result = self.inqueue.get()
task, result = self.inqueue.get(timeout=1)
if 'taskid' in task and 'project' in task and 'url' in task:
logger.info('result %s:%s %s -> %.30r' % (
task['project'], task['taskid'], task['url'], result))
else:
logger.warning('result UNKNOW -> %.30r' % result)
ret = self.on_result(task, result)
except Queue.Empty as e:
time.sleep(1)
continue
except KeyboardInterrupt:
break
Expand Down

0 comments on commit 77c2d5f

Please sign in to comment.