diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-14 02:35:45 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-14 02:35:53 +0200 |
| commit | 211ace6cc0168647e00bcc20a909aead50b8ad0a (patch) | |
| tree | ef218ea44c91580b0daffc9eaa70270238598b97 /packages/meshbay-node/src/meshbay_node/daemon.py | |
| parent | a1aaf31a27d1c1b65efc3c6a25fc6cc8771578ea (diff) | |
| download | meshbay-211ace6cc0168647e00bcc20a909aead50b8ad0a.tar.gz | |
fix(node): an added root is served before it is scanned
Adding a large directory to a running group made the reload await the
scan of the new root before putting the new RootSet in the group's
context, holding _reload_lock the whole time. For the hours a large drive
takes to hash, the node served the old set:
- a file request under the new root got None from entry_abs_path and the
handler died on None.exists() without replying;
- a writable/removable toggle answered with the live table, still the
old one, so the directory vanished from the operator's settings;
- reconcile saw every file the scan had not reached as a missed event and
hashed it again on the same executor, rewriting progress under the scan.
retarget now applies the set, the roots table and the watcher first, and
with wait=False scans the added roots in the background; the daemon swaps
ctx["roots"] before calling it. A scan lock shared by the initial scan,
added-root scans and reconcile makes the reconcile loop sit out a running
scan without backing off. Every transport site that resolves an entry
answers ROOT_NOT_SERVED instead of crashing, and a delete keeps the entry.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T6jPTeocXA1BePekdsgPya
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/daemon.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/daemon.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/daemon.py b/packages/meshbay-node/src/meshbay_node/daemon.py index 518f221..c9c362a 100644 --- a/packages/meshbay-node/src/meshbay_node/daemon.py +++ b/packages/meshbay-node/src/meshbay_node/daemon.py @@ -805,8 +805,15 @@ class NodeDaemon: continue log.info("Group %r roots changed: %s", group_cfg.name, ", ".join(f"{r.name}={r.path}" for r in roots)) - await indexer.retarget(roots) + # The new set is what the node serves from this moment, and the + # scan of an added root is not waited for. Awaiting it here held + # `_reload_lock` and the old set for as long as the scan ran — + # hours for a large drive — so every file request under the new + # root found no root to resolve against, and any op answering with + # the live table (a writable/removable toggle) showed the directory + # gone from the operator's settings. ctx["roots"] = roots + await indexer.retarget(roots, wait=False) changed += 1 # ── Hot-load new groups ────────────────────────────────────────── |