aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/ops
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-14 10:17:49 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-14 10:17:49 +0200
commit80ac882346b474bb7ea4e8c8afd4694bd13dd9dd (patch)
tree3aebf475a23dc3e44dff1a6c577d8af82418d024 /packages/meshbay-node/src/meshbay_node/ops
parentaf542a40aec6ffe0ac06798d99abd00a24eb9c50 (diff)
downloadmeshbay-80ac882346b474bb7ea4e8c8afd4694bd13dd9dd.tar.gz
feat(node): skip a file the disk stops answering for, then pause its root
A Windows tester's scan stuck for good on one directory of a large disk: one read that never returned held the indexer's only thread, and with it every root behind that one. - A disk call is timed by its silence, not its length: each directory entry listed and each megabyte read counts as an answer. After 60 s of silence the call is abandoned on its daemon thread, the file is noted unread and the scan goes on. - Three silent files in a row pause the root (not persisted). Resume skips the files already known to give no answer; a restart, a replug or a change to the file retries them. - The walk is per directory with os.scandir: a subdirectory that cannot be listed costs itself, and a listing that stops answering pauses the root at once. A scan no longer stats anything from the event loop. - The log names the file after 10 s of silence, the indexing band shows it, and Group settings shows the paused root, where it stuck and the unread files with their reason, on the node's machine only. - generate_http_api.py writes LF on Windows too. Verified with real kernel-blocked opens (an unacknowledged oplock) in the installed frozen app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/ops')
-rw-r--r--packages/meshbay-node/src/meshbay_node/ops/roots.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ops/roots.py b/packages/meshbay-node/src/meshbay_node/ops/roots.py
index 187e134..0cd2daa 100644
--- a/packages/meshbay-node/src/meshbay_node/ops/roots.py
+++ b/packages/meshbay-node/src/meshbay_node/ops/roots.py
@@ -361,13 +361,16 @@ async def pause_root(state: dict, group_id: str, root_name: str) -> dict:
async def resume_root(state: dict, group_id: str, root_name: str) -> dict:
"""Index a paused root again; the walk runs in the background."""
roots, root = _live_root(state, group_id, root_name)
- if not root.paused:
+ indexer = state.get("indexers", {}).get(group_id)
+ # A root the node paused by itself, its disk having stopped answering, is
+ # paused on the indexer's own set and nowhere in the roster.
+ own = indexer.roots.by_name(root.name) if indexer else None
+ if not root.paused and not (own is not None and own.paused):
return {"status": "already_resumed", "name": root.name,
"group_id": group_id, "roots": roots.describe()}
await _roster(state).set_root_paused(
group_id, root.name, False, set_by=state.get("node_user_id", ""))
- indexer = state.get("indexers", {}).get(group_id)
if indexer:
await indexer.resume_root(root.name)
root.paused = False