mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-08 07:48:11 +08:00
fix reincarnation bug without timeout set
This commit is contained in:
+2
-2
@@ -193,7 +193,7 @@ class Sentinel(object):
|
|||||||
else:
|
else:
|
||||||
self.pool.remove(process)
|
self.pool.remove(process)
|
||||||
self.spawn_worker()
|
self.spawn_worker()
|
||||||
if int(process.timer.value) >= self.timeout:
|
if self.timeout and int(process.timer.value) >= self.timeout:
|
||||||
# only need to terminate on timeout, otherwise we risk destabilizing the queues
|
# only need to terminate on timeout, otherwise we risk destabilizing the queues
|
||||||
process.terminate()
|
process.terminate()
|
||||||
logger.warn(_("reincarnated worker {} after timeout").format(process.name))
|
logger.warn(_("reincarnated worker {} after timeout").format(process.name))
|
||||||
@@ -205,6 +205,7 @@ class Sentinel(object):
|
|||||||
self.reincarnations += 1
|
self.reincarnations += 1
|
||||||
|
|
||||||
def spawn_cluster(self):
|
def spawn_cluster(self):
|
||||||
|
self.pool = []
|
||||||
Stat(self).save()
|
Stat(self).save()
|
||||||
for i in range(self.pool_size):
|
for i in range(self.pool_size):
|
||||||
self.spawn_worker()
|
self.spawn_worker()
|
||||||
@@ -282,7 +283,6 @@ class Sentinel(object):
|
|||||||
count += 1
|
count += 1
|
||||||
# Final status
|
# Final status
|
||||||
Stat(self).save()
|
Stat(self).save()
|
||||||
self.pool = []
|
|
||||||
|
|
||||||
|
|
||||||
def pusher(task_queue, e, list_key=Conf.Q_LIST, r=redis_client):
|
def pusher(task_queue, e, list_key=Conf.Q_LIST, r=redis_client):
|
||||||
|
|||||||
Reference in New Issue
Block a user