1
0
Fork 0

run: recreate the sync_queue on run, it seems to have strange behaviour when created before the fork

This commit is contained in:
nemunaire 2017-07-16 21:15:10 +02:00 committed by Pierre-Olivier Mercier
parent a5479d7b0d
commit 94ff951b2e
1 changed files with 7 additions and 0 deletions

View File

@ -151,6 +151,11 @@ class Bot(threading.Thread):
def run(self):
global sync_queue
# Rewrite the sync_queue, as the daemonization process tend to disturb it
old_sync_queue, sync_queue = sync_queue, JoinableQueue()
while not old_sync_queue.empty():
sync_queue.put_nowait(old_sync_queue.get())
self._poll.register(sync_queue._reader, select.POLLIN | select.POLLPRI)
logger.info("Starting main loop")
@ -190,6 +195,8 @@ class Bot(threading.Thread):
args = sync_queue.get()
action = args.pop(0)
logger.debug("Executing sync_queue action %s%s", action, args)
if action == "sckt" and len(args) >= 2:
try:
if args[0] == "write":