X-Git-Url: http://git.treefish.org/~alex/mtxbot.git/blobdiff_plain/c4f107a1a27dc60858fc694839c981e001cf447f..94f38bb41b8a779a1a9345998603fe6b536511c3:/src/mtxbot.py diff --git a/src/mtxbot.py b/src/mtxbot.py index 722c8db..011341f 100755 --- a/src/mtxbot.py +++ b/src/mtxbot.py @@ -36,6 +36,9 @@ async def main(): done, pending = await asyncio.wait( presence_tasks, return_when = asyncio.FIRST_EXCEPTION ) + for presence in presences: + presence.stop() + for task in done: try: task.result() @@ -43,6 +46,7 @@ async def main(): logging.error( "Error running task: %s" % str(e) ) finally: + logging.info("Closing client...") await client.close() logging.basicConfig(format='[%(asctime)s] %(levelname)s: %(message)s', @@ -51,6 +55,7 @@ logging.basicConfig(format='[%(asctime)s] %(levelname)s: %(message)s', mainPid = os.getpid() signal.signal(signal.SIGINT, handleInterrupt) +signal.signal(signal.SIGTERM, handleInterrupt) stop = False