From 2dc56571d613495a196ee61cb1a95dc3426a07c7 Mon Sep 17 00:00:00 2001 From: Romuald Bierbasz Date: Mon, 21 Oct 2019 14:50:33 +0200 Subject: [PATCH] Revert "Add more logs" This reverts commit 21ab8bf33d3c2714b8c7af2da8036fe8baae20ea. --- src/galaxy/api/jsonrpc.py | 6 ++++-- src/galaxy/api/plugin.py | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/galaxy/api/jsonrpc.py b/src/galaxy/api/jsonrpc.py index bd5ab64..4087f58 100644 --- a/src/galaxy/api/jsonrpc.py +++ b/src/galaxy/api/jsonrpc.py @@ -129,8 +129,9 @@ class Server(): await asyncio.sleep(0) # To not starve task queue def close(self): - logging.info("Closing JSON-RPC server - not more messages will be read") - self._active = False + if self._active: + logging.info("Closing JSON-RPC server - not more messages will be read") + self._active = False async def wait_closed(self): await self._task_manager.wait() @@ -281,6 +282,7 @@ class NotificationClient(): self._send(notification) async def close(self): + self._task_manager.cancel() await self._task_manager.wait() def _send(self, data): diff --git a/src/galaxy/api/plugin.py b/src/galaxy/api/plugin.py index ab2461a..78a89e5 100644 --- a/src/galaxy/api/plugin.py +++ b/src/galaxy/api/plugin.py @@ -184,6 +184,7 @@ class Plugin: async def run(self): """Plugin's main coroutine.""" await self._server.run() + logging.debug("Plugin run loop finished") def close(self) -> None: if not self._active: @@ -196,10 +197,12 @@ class Plugin: self._active = False async def wait_closed(self) -> None: + logging.debug("Waiting for plugin to close") await self._external_task_manager.wait() await self._internal_task_manager.wait() await self._server.wait_closed() await self._notification_client.close() + logging.debug("Plugin closed") def create_task(self, coro, description): """Wrapper around asyncio.create_task - takes care of canceling tasks on shutdown"""