mirror of https://github.com/coddrago/Heroku
fix [-] Exception on event loop! Task was destroyed but it is pending!
parent
af59cc4e50
commit
47ad704756
|
@ -972,17 +972,19 @@ class Heroku:
|
||||||
|
|
||||||
await asyncio.gather(*[self.amain_wrapper(client) for client in self.clients])
|
await asyncio.gather(*[self.amain_wrapper(client) for client in self.clients])
|
||||||
|
|
||||||
def _shutdown_handler(self, signum, frame):
|
async def _shutdown_handler(self):
|
||||||
"""Shutdown handler"""
|
for t in (getattr(self, "_task", None), getattr(self, "_cleaner_task", None)):
|
||||||
logging.info("Bye")
|
if t: t.cancel()
|
||||||
for client in self.clients:
|
await self._dp.stop_polling()
|
||||||
client.disconnect()
|
await self.bot.session.close()
|
||||||
|
for c in self.clients:
|
||||||
|
await c.disconnect()
|
||||||
|
self.loop.stop()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
"""Main entrypoint"""
|
"""Main entrypoint"""
|
||||||
#todosignal.signal(signal.SIGINT, self._shutdown_handler)
|
signal.signal(signal.SIGINT, self._shutdown_handler)
|
||||||
self.loop.run_until_complete(self._main())
|
self.loop.run_until_complete(self._main())
|
||||||
self.loop.close()
|
self.loop.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue