mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 10:27:37 -02:30
Fix an issue with the callback receiver that prevents preserving
database connections across multiprocessing processes during process recycling
This commit is contained in:
@@ -20,6 +20,7 @@ from django.contrib.auth.models import User
|
|||||||
from django.utils.dateparse import parse_datetime
|
from django.utils.dateparse import parse_datetime
|
||||||
from django.utils.timezone import now, is_aware, make_aware
|
from django.utils.timezone import now, is_aware, make_aware
|
||||||
from django.utils.tzinfo import FixedOffset
|
from django.utils.tzinfo import FixedOffset
|
||||||
|
from django.db import connection
|
||||||
|
|
||||||
# AWX
|
# AWX
|
||||||
from awx.main.models import *
|
from awx.main.models import *
|
||||||
@@ -56,7 +57,7 @@ class CallbackReceiver(object):
|
|||||||
worker_queues = []
|
worker_queues = []
|
||||||
|
|
||||||
if use_workers:
|
if use_workers:
|
||||||
|
connection.close()
|
||||||
for idx in range(WORKERS):
|
for idx in range(WORKERS):
|
||||||
queue_port_actual = queue_port + "-%s" % str(idx)
|
queue_port_actual = queue_port + "-%s" % str(idx)
|
||||||
queue_context = zmq.Context()
|
queue_context = zmq.Context()
|
||||||
@@ -121,6 +122,7 @@ class CallbackReceiver(object):
|
|||||||
queue_actual[0] = 0
|
queue_actual[0] = 0
|
||||||
print("Recycling worker process")
|
print("Recycling worker process")
|
||||||
queue_actual[2].join()
|
queue_actual[2].join()
|
||||||
|
connection.close()
|
||||||
w = Process(target=self.callback_worker, args=(queue_port + "-%s" % str(total_messages % WORKERS),))
|
w = Process(target=self.callback_worker, args=(queue_port + "-%s" % str(total_messages % WORKERS),))
|
||||||
w.daemon = True
|
w.daemon = True
|
||||||
w.start()
|
w.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user