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