Add timeout for exit-settting-offline

This commit is contained in:
miruka 2020-07-16 23:50:44 -04:00
parent 4784c80ed9
commit a17daf61c8

View File

@ -311,10 +311,17 @@ class MatrixClient(nio.AsyncClient):
await self._stop() await self._stop()
if self._presence != "offline": if self._presence != "offline":
await self.set_presence("offline", save=False) try:
await asyncio.wait_for(
self.set_presence("offline", save=False),
timeout = 10,
)
except asyncio.TimeoutError:
log.warn("%s timed out", self.user_id)
else:
log.info("%s termined", self.user_id)
await self.close() await self.close()
log.info("%s termined", self.user_id)
@property @property
def syncing(self) -> bool: def syncing(self) -> bool: