mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-27 09:08:13 +08:00
+5
-3
@@ -211,7 +211,8 @@ class Sentinel:
|
|||||||
:param process: the process to reincarnate
|
:param process: the process to reincarnate
|
||||||
:type process: Process or None
|
:type process: Process or None
|
||||||
"""
|
"""
|
||||||
close_old_django_connections()
|
if not Conf.SYNC:
|
||||||
|
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(_(f"reincarnated monitor {process.name} after sudden death"))
|
logger.error(_(f"reincarnated monitor {process.name} after sudden death"))
|
||||||
@@ -235,7 +236,8 @@ class Sentinel:
|
|||||||
def spawn_cluster(self):
|
def spawn_cluster(self):
|
||||||
self.pool = []
|
self.pool = []
|
||||||
Stat(self).save()
|
Stat(self).save()
|
||||||
close_old_django_connections()
|
if not Conf.SYNC:
|
||||||
|
db.connection.close()
|
||||||
# spawn worker pool
|
# spawn worker pool
|
||||||
for __ in range(self.pool_size):
|
for __ in range(self.pool_size):
|
||||||
self.spawn_worker()
|
self.spawn_worker()
|
||||||
@@ -731,4 +733,4 @@ def rss_check():
|
|||||||
return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss >= Conf.MAX_RSS
|
return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss >= Conf.MAX_RSS
|
||||||
elif psutil:
|
elif psutil:
|
||||||
return psutil.Process().memory_info().rss >= Conf.MAX_RSS * 1024
|
return psutil.Process().memory_info().rss >= Conf.MAX_RSS * 1024
|
||||||
return False
|
return False
|
||||||
Reference in New Issue
Block a user