aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Perry <avaglir@gmail.com>2017-07-26 18:44:26 -0400
committerNathan Perry <avaglir@gmail.com>2017-07-26 18:44:26 -0400
commit4fea572cb19936bd1bb57e084750b852d46291e0 (patch)
treec9c002a07067978e8ae3416535ca4c4876072fa9
parent4dce28a53b9200ad8796f5764b5dd7f3e22d76d5 (diff)
check for loop closepython
-rwxr-xr-xbot.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bot.py b/bot.py
index 2385156..7a9f2bf 100755
--- a/bot.py
+++ b/bot.py
@@ -342,6 +342,10 @@ loop = get_event_loop()
loop.set_debug(True)
while True:
+ if loop.is_closed():
+ print('Event loop closed. Exiting.')
+ exit()
+
try:
logger.info('starting')
loop.run_until_complete(client.start(config['username'], config['password']))
@@ -358,4 +362,3 @@ while True:
loop.close()
except Exception:
logger.exception('main loop')
-