From 2a1f618d237d71f5e20ed341f00e678d0ccb52da Mon Sep 17 00:00:00 2001 From: Alex Carney Date: Sun, 1 Dec 2024 15:37:22 +0000 Subject: [PATCH] lsp: Ensure database connections are closed during shutdown --- .../esbonio/server/features/project_manager/manager.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/esbonio/esbonio/server/features/project_manager/manager.py b/lib/esbonio/esbonio/server/features/project_manager/manager.py index 9747fffa4..dfc04af0c 100644 --- a/lib/esbonio/esbonio/server/features/project_manager/manager.py +++ b/lib/esbonio/esbonio/server/features/project_manager/manager.py @@ -17,6 +17,10 @@ def __init__(self, *args, **kwargs): self.projects: dict[str, Project] = {} """Holds active project instances""" + async def shutdown(self, params: None): + for project in self.projects.values(): + await project.close() + def register_project(self, scope: str, dbpath: str | pathlib.Path): """Register a project.""" self.logger.debug("Registered project for scope '%s': '%s'", scope, dbpath)