Skip to content

Commit f5d47b0

Browse files
committed
Add timeout to shutdown
1 parent 02f4faa commit f5d47b0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/galaxy/api/plugin.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,14 @@ def close(self) -> None:
200200
logger.info("Closing plugin")
201201
self._connection.close()
202202
self._external_task_manager.cancel()
203-
self._internal_task_manager.create_task(self.shutdown(), "shutdown")
203+
204+
async def shutdown():
205+
try:
206+
await asyncio.wait_for(self.shutdown(), 30)
207+
except asyncio.TimeoutError:
208+
logging.warning("Plugin shutdown timed out")
209+
210+
self._internal_task_manager.create_task(shutdown(), "shutdown")
204211
self._active = False
205212

206213
async def wait_closed(self) -> None:

0 commit comments

Comments
 (0)