aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/ui
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/ui')
-rw-r--r--packages/meshbay-node/src/meshbay_node/ui/app.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ui/app.py b/packages/meshbay-node/src/meshbay_node/ui/app.py
index 4ad3787..de2542e 100644
--- a/packages/meshbay-node/src/meshbay_node/ui/app.py
+++ b/packages/meshbay-node/src/meshbay_node/ui/app.py
@@ -12,12 +12,12 @@ no server-rendered UI: the Node page ships in the desktop client (see
`docs/refactor-node-ui.md`).
"""
-import asyncio
import logging
from fastapi import FastAPI, HTTPException, Query
from fastapi.responses import JSONResponse
+from meshbay_common.background import spawn
from meshbay_node import __version__, ops
from meshbay_node.indexer.indexer import DirectoryIndexer
@@ -179,7 +179,7 @@ def create_ui_app(state: dict) -> FastAPI:
))
reload_fn = state.get("reload_fn")
if reload_fn:
- asyncio.ensure_future(reload_fn())
+ spawn(reload_fn())
return result
@app.post("/api/groups/detach")
@@ -190,7 +190,7 @@ def create_ui_app(state: dict) -> FastAPI:
))
reload_fn = state.get("reload_fn")
if reload_fn:
- asyncio.ensure_future(reload_fn())
+ spawn(reload_fn())
return result
@app.delete("/api/groups/{group_id}/files/{file_id}")
@@ -373,7 +373,7 @@ def create_ui_app(state: dict) -> FastAPI:
))
reload_fn = state.get("reload_fn")
if reload_fn:
- asyncio.ensure_future(reload_fn())
+ spawn(reload_fn())
return result
@app.patch("/api/groups/{group_id}/roots/{root_name}")
@@ -385,7 +385,7 @@ def create_ui_app(state: dict) -> FastAPI:
))
reload_fn = state.get("reload_fn")
if reload_fn:
- asyncio.ensure_future(reload_fn())
+ spawn(reload_fn())
return result
@app.put("/api/groups/{group_id}/roots/{root_name}/eject")
@@ -401,11 +401,11 @@ def create_ui_app(state: dict) -> FastAPI:
result = await _op(lambda: ops.remove_root(state, group_id, root_name))
reload_fn = state.get("reload_fn")
if reload_fn:
- asyncio.ensure_future(reload_fn())
+ spawn(reload_fn())
return result
- # asyncio.ensure_future above schedules the reload (and whatever initial
- # scan it triggers) on the daemon's own event loop — it has no link to
+ # `spawn` above schedules the reload (and whatever initial scan it
+ # triggers) on the daemon's own event loop — it has no link to
# this HTTP request or to any browser tab. Closing the client that made
# this call does not cancel it: the scan is the node's own background
# work, not something borrowed from the request that started it.