log a ton start/stop sequence

This is temporary: sometimes it gets stuck into stop() (I think?) so I'm
adding some debug prints everywhere so every instance can be used to
spot this issue
This commit is contained in:
əlemi 2022-05-06 10:35:24 +02:00
parent bbe668bcec
commit fdfe71b481
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -136,9 +136,11 @@ class Treepuncher(
await super().start() await super().start()
await self.notifier.start() await self.notifier.start()
self.logger.debug("Notifier started")
await asyncio.gather( await asyncio.gather(
*(m.initialize() for m in self.modules) *(m.initialize() for m in self.modules)
) )
self.logger.debug("Addons initialized")
self._processing = True self._processing = True
self._worker = asyncio.get_event_loop().create_task(self._work()) self._worker = asyncio.get_event_loop().create_task(self._work())
self.scheduler.resume() self.scheduler.resume()
@ -152,10 +154,13 @@ class Treepuncher(
await self.dispatcher.disconnect(block=not force) await self.dispatcher.disconnect(block=not force)
if not force: if not force:
await self._worker await self._worker
self.logger.debug("Joined worker")
await self.join_callbacks() await self.join_callbacks()
self.logger.debug("Joined callbacks")
await asyncio.gather( await asyncio.gather(
*(m.cleanup() for m in self.modules) *(m.cleanup() for m in self.modules)
) )
self.logger.debug("Cleaned up addons")
await super().stop() await super().stop()
self.logger.info("Treepuncher stopped") self.logger.info("Treepuncher stopped")
@ -170,6 +175,7 @@ class Treepuncher(
return m return m
async def _work(self): async def _work(self):
self.logger.debug("Worker started")
try: try:
if "force_proto" in self.cfg: if "force_proto" in self.cfg:
self.dispatcher.set_proto(self.cfg.getint('force_proto')) self.dispatcher.set_proto(self.cfg.getint('force_proto'))
@ -200,3 +206,4 @@ class Treepuncher(
if self._processing: if self._processing:
await self.stop(force=True) await self.stop(force=True)
self.logger.debug("Worker finished")