done, pending = await asyncio.wait( presence_tasks,
return_when = asyncio.FIRST_EXCEPTION )
+ for task in presence_tasks:
+ task.stop()
+
for task in done:
try:
task.result()
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',
mainPid = os.getpid()
signal.signal(signal.SIGINT, handleInterrupt)
+signal.signal(signal.SIGTERM, handleInterrupt)
stop = False