diff options
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/daemon.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/daemon.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/daemon.py b/packages/meshbay-node/src/meshbay_node/daemon.py index c9c362a..932a90d 100644 --- a/packages/meshbay-node/src/meshbay_node/daemon.py +++ b/packages/meshbay-node/src/meshbay_node/daemon.py @@ -764,9 +764,27 @@ class NodeDaemon: Serialised by _reload_lock: fire-and-forget reloads from config-mutating endpoints can overlap with the wizard's explicit /api/reload call, and two concurrent hot-loads of the same group corrupt the runtime state. + + The reload belongs to the node, never to whoever asked for it. A root + added from a browser reaches here through the operator's WebRTC session, + whose tasks are all cancelled when that session closes — and on + 2026-09-14 one closed 47 s into the scan of a 900 GB root. The reload + died without a line in the log, the new root was in node.toml and in + the indexer but never in the group's context, and nothing ever tried + again: the lock was free, and nobody was waiting on it. So the work runs + in a task of its own, and a caller that goes away only stops waiting. """ - async with self._reload_lock: - await self._reload_config_inner() + await asyncio.shield(spawn(self._reload_config_locked(), what="config reload")) + + async def _reload_config_locked(self) -> None: + try: + async with self._reload_lock: + await self._reload_config_inner() + except asyncio.CancelledError: + log.warning("Config reload cancelled before it finished — the node may " + "be serving part of the previous configuration until the " + "next reload") + raise async def _reload_config_inner(self) -> None: log.info("Reloading config from %s", self._config_path) |