mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-04 21:48:12 +08:00
Closes db connections on reincarnate
This commit is contained in:
+1
-1
@@ -166,6 +166,7 @@ class Sentinel(object):
|
|||||||
:param process: the process to reincarnate
|
:param process: the process to reincarnate
|
||||||
:type process: Process or None
|
:type process: Process or None
|
||||||
"""
|
"""
|
||||||
|
db.connections.close_all() # Close any old connections
|
||||||
if process == self.monitor:
|
if process == self.monitor:
|
||||||
self.monitor = self.spawn_monitor()
|
self.monitor = self.spawn_monitor()
|
||||||
logger.error(_("reincarnated monitor {} after sudden death").format(process.name))
|
logger.error(_("reincarnated monitor {} after sudden death").format(process.name))
|
||||||
@@ -388,7 +389,6 @@ def worker(task_queue, result_queue, timer, timeout=Conf.TIMEOUT):
|
|||||||
timer.value = -1 # Idle
|
timer.value = -1 # Idle
|
||||||
# Recycle
|
# Recycle
|
||||||
if task_count == Conf.RECYCLE:
|
if task_count == Conf.RECYCLE:
|
||||||
db.connections.close_all() # Close any active connections
|
|
||||||
timer.value = -2 # Recycled
|
timer.value = -2 # Recycled
|
||||||
break
|
break
|
||||||
logger.info(_('{} stopped doing work').format(name))
|
logger.info(_('{} stopped doing work').format(name))
|
||||||
|
|||||||
Reference in New Issue
Block a user