Handle multiple SIGTERM
This commit is contained in:
parent
a624fca347
commit
1d554e0b0f
@ -149,6 +149,8 @@ class Bot(threading.Thread):
|
||||
|
||||
|
||||
def run(self):
|
||||
global sync_queue
|
||||
|
||||
self._poll.register(sync_queue._reader, select.POLLIN | select.POLLPRI)
|
||||
|
||||
logger.info("Starting main loop")
|
||||
@ -222,6 +224,7 @@ class Bot(threading.Thread):
|
||||
c = Consumer(self)
|
||||
self.cnsr_thrd.append(c)
|
||||
c.start()
|
||||
sync_queue = None
|
||||
logger.info("Ending main loop")
|
||||
|
||||
|
||||
@ -566,6 +569,7 @@ class Bot(threading.Thread):
|
||||
|
||||
self.datastore.close()
|
||||
|
||||
if self.stop is False or sync_queue is not None:
|
||||
self.stop = True
|
||||
sync_act("end")
|
||||
sync_queue.join()
|
||||
|
Loading…
Reference in New Issue
Block a user