migrate event table primary keys from integer to bigint

see: https://github.com/ansible/awx/issues/6010
This commit is contained in:
Ryan Petrello
2020-02-21 13:03:24 -05:00
parent 3045511401
commit c8044b4755
5 changed files with 200 additions and 3 deletions

View File

@@ -101,7 +101,6 @@ class AWXConsumerBase(object):
def run(self, *args, **kwargs):
signal.signal(signal.SIGINT, self.stop)
signal.signal(signal.SIGTERM, self.stop)
self.worker.on_start()
# Child should implement other things here
@@ -115,6 +114,7 @@ class AWXConsumerBase(object):
class AWXConsumerRedis(AWXConsumerBase):
def run(self, *args, **kwargs):
super(AWXConsumerRedis, self).run(*args, **kwargs)
self.worker.on_start()
queue = redis.Redis.from_url(settings.BROKER_URL)
while True:
@@ -130,12 +130,16 @@ class AWXConsumerPG(AWXConsumerBase):
super(AWXConsumerPG, self).run(*args, **kwargs)
logger.warn(f"Running worker {self.name} listening to queues {self.queues}")
init = False
while True:
try:
with pg_bus_conn() as conn:
for queue in self.queues:
conn.listen(queue)
if init is False:
self.worker.on_start()
init = True
for e in conn.events():
self.process_task(json.loads(e.payload))
if self.should_stop: