Skip to content

Commit

Permalink
Fix teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Aug 16, 2024
1 parent e6ee057 commit 8701267
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hypha/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.20.23.post5"
"version": "0.20.23.post6"
}
3 changes: 2 additions & 1 deletion hypha/core/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,5 +581,6 @@ async def teardown(self):
self._ready = False
context = {"user": self._root_user.model_dump(), "ws": "public"}
logger.info("Tearing down the public workspace...")
await self._public_workspace_interface.unload(context=context)
client_id = self._public_workspace_interface.rpc.get_client_info()["id"]
await self.remove_client(client_id, "public", self._root_user, unload=True)
logger.info("Teardown complete")
1 change: 0 additions & 1 deletion hypha/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ async def run_app(
) -> Response:
if service_id == "ws":
if not path:
template = self.jinja_env.get_template("ws/index.html")
return FileResponse(
safe_join(str(self.ws_apps_dir), "ws/index.html")
)
Expand Down
4 changes: 3 additions & 1 deletion hypha/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
from os import environ as env
from pathlib import Path
import asyncio

from dotenv import find_dotenv, load_dotenv
from fastapi import FastAPI
Expand Down Expand Up @@ -173,10 +174,11 @@ async def lifespan(app: FastAPI):
args.startup_functions = args.startup_functions or []
await store.init(args.reset_redis, startup_functions=args.startup_functions)
yield
await websocket_server.stop()
# Emit the shutdown event
await store.get_event_bus().emit_local("shutdown")
await store.teardown()
await asyncio.sleep(0.1)
await websocket_server.stop()

application = FastAPI(
title="Hypha",
Expand Down

0 comments on commit 8701267

Please sign in to comment.