mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-05 23:51:48 -05:00
add additional DB retry logic to the callback receiver
initially, I implemented this for _only_ the task worker, but it's probably needed for callback event workers, too
This commit is contained in:
@@ -7,6 +7,7 @@ import signal
|
||||
from uuid import UUID
|
||||
from Queue import Empty as QueueEmpty
|
||||
|
||||
from django import db
|
||||
from kombu import Producer
|
||||
from kombu.mixins import ConsumerMixin
|
||||
|
||||
@@ -128,6 +129,10 @@ class BaseWorker(object):
|
||||
logger.error("Exception on worker {}, restarting: ".format(idx) + str(e))
|
||||
continue
|
||||
try:
|
||||
for conn in db.connections.all():
|
||||
# If the database connection has a hiccup during the prior message, close it
|
||||
# so we can establish a new connection
|
||||
conn.close_if_unusable_or_obsolete()
|
||||
self.perform_work(body, *args)
|
||||
finally:
|
||||
if 'uuid' in body:
|
||||
|
||||
Reference in New Issue
Block a user