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])
|
||||
|
||||
def _shutdown_handler(self, signum, frame):
|
||||
"""Shutdown handler"""
|
||||
logging.info("Bye")
|
||||
for client in self.clients:
|
||||
client.disconnect()
|
||||
|
||||
async def _shutdown_handler(self):
|
||||
for t in (getattr(self, "_task", None), getattr(self, "_cleaner_task", None)):
|
||||
if t: t.cancel()
|
||||
await self._dp.stop_polling()
|
||||
await self.bot.session.close()
|
||||
for c in self.clients:
|
||||
await c.disconnect()
|
||||
self.loop.stop()
|
||||
sys.exit(0)
|
||||
|
||||
def main(self):
|
||||
"""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.close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue