Spaces:
Running
Running
Delete CRDT rooms when a workspace is deleted.
Browse files
lynxkite-app/src/lynxkite_app/crdt.py
CHANGED
@@ -300,6 +300,11 @@ async def lifespan(app):
|
|
300 |
print("closing websocket server")
|
301 |
|
302 |
|
|
|
|
|
|
|
|
|
|
|
303 |
def sanitize_path(path):
|
304 |
return os.path.relpath(os.path.normpath(os.path.join("/", path)), "/")
|
305 |
|
|
|
300 |
print("closing websocket server")
|
301 |
|
302 |
|
303 |
+
def delete_room(name: str):
|
304 |
+
if name in ws_websocket_server.rooms:
|
305 |
+
del ws_websocket_server.rooms[name]
|
306 |
+
|
307 |
+
|
308 |
def sanitize_path(path):
|
309 |
return os.path.relpath(os.path.normpath(os.path.join("/", path)), "/")
|
310 |
|
lynxkite-app/src/lynxkite_app/main.py
CHANGED
@@ -76,6 +76,7 @@ async def delete_workspace(req: dict):
|
|
76 |
assert json_path.is_relative_to(data_path), f"Path '{json_path}' is invalid"
|
77 |
json_path.unlink()
|
78 |
crdt_path.unlink()
|
|
|
79 |
|
80 |
|
81 |
@app.get("/api/load")
|
|
|
76 |
assert json_path.is_relative_to(data_path), f"Path '{json_path}' is invalid"
|
77 |
json_path.unlink()
|
78 |
crdt_path.unlink()
|
79 |
+
crdt.delete_room(req["path"])
|
80 |
|
81 |
|
82 |
@app.get("/api/load")
|