Skip to content

Commit b402722

Browse files
authored
Release context resources on UI shutdown (#1508)
1 parent c0646df commit b402722

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

web/server/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from web.server.api.endpoints import api_router
1111
from web.server.console import api_console
1212
from web.server.exceptions import ApiException
13+
from web.server.settings import get_context, get_settings
1314
from web.server.watcher import watch_project
1415

1516
app = FastAPI()
@@ -39,9 +40,11 @@ async def dispatch() -> None:
3940

4041

4142
@app.on_event("shutdown")
42-
def shutdown_event() -> None:
43+
async def shutdown_event() -> None:
4344
app.state.dispatch_task.cancel()
4445
app.state.watch_task.cancel()
46+
context = await get_context(settings=get_settings())
47+
context.close()
4548

4649

4750
@app.exception_handler(ApiException)

0 commit comments

Comments
 (0)