diff --git a/pyhilo/websocket.py b/pyhilo/websocket.py index d18525c..6b7af7a 100644 --- a/pyhilo/websocket.py +++ b/pyhilo/websocket.py @@ -298,7 +298,7 @@ async def _clean_queue(self) -> None: async def async_disconnect(self) -> None: """Disconnect from the websocket server.""" - self._clean_queue() + await self._clean_queue() if not self.connected: return @@ -323,7 +323,7 @@ async def async_listen(self) -> None: finally: LOG.info("Websocket: Listen completed; cleaning up") self._watchdog.cancel() - self._clean_queue() + await self._clean_queue() for callback in self._disconnect_callbacks: schedule_callback(callback)