Skip to content
Snippets Groups Projects
Commit ff8cfebe authored by Finn's avatar Finn
Browse files

Bot now catches errors thrown when updating session.

parent 75d25682
No related branches found
No related tags found
Loading
......@@ -17,11 +17,12 @@
Bot
====
Creates a bot session.
Creates a bot session and sends updates to the server.
"""
import asyncio
import logging
import sys
class Bot:
......@@ -45,6 +46,7 @@ class Bot:
loop.run_forever()
except KeyboardInterrupt:
pass
finally:
task.cancel()
loop.close()
......@@ -54,5 +56,11 @@ class Bot:
Calls the server periodically to inform the server the client has not died.
"""
while True:
try:
self._bot_session.update_bot_session()
except Exception as e:
self.logger.error("Error: [{}]".format(e))
raise
await asyncio.sleep(self._update_period)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment