mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-10 21:40:56 +08:00
Merge pull request #337 from jannero/timer-handling
Fix concurrency issue in timeout timer value processing
This commit is contained in:
@@ -209,6 +209,7 @@ class Sentinel(object):
|
||||
while not self.stop_event.is_set() or not counter:
|
||||
# Check Workers
|
||||
for p in self.pool:
|
||||
with p.timer.get_lock():
|
||||
# Are you alive?
|
||||
if not p.is_alive() or p.timer.value == 0:
|
||||
self.reincarnate(p)
|
||||
@@ -382,6 +383,7 @@ def worker(task_queue, result_queue, timer, timeout=Conf.TIMEOUT):
|
||||
result = ('{} : {}'.format(e, traceback.format_exc()), False)
|
||||
if error_reporter:
|
||||
error_reporter.report()
|
||||
with timer.get_lock():
|
||||
# Process result
|
||||
task['result'] = result[0]
|
||||
task['success'] = result[1]
|
||||
|
||||
Reference in New Issue
Block a user