aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/ops
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/ops')
-rw-r--r--packages/meshbay-node/src/meshbay_node/ops/files.py7
-rw-r--r--packages/meshbay-node/src/meshbay_node/ops/roots.py7
2 files changed, 10 insertions, 4 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ops/files.py b/packages/meshbay-node/src/meshbay_node/ops/files.py
index 4609627..a448103 100644
--- a/packages/meshbay-node/src/meshbay_node/ops/files.py
+++ b/packages/meshbay-node/src/meshbay_node/ops/files.py
@@ -4,8 +4,11 @@ from __future__ import annotations
import asyncio
import logging
+import os
from pathlib import Path
+from meshbay_common.paths import long_path
+
from meshbay_node.ops.core import OpError, _group_ctx
log = logging.getLogger("meshbay_node.ops")
@@ -41,7 +44,7 @@ async def delete_file(state: dict, group_id: str, file_id: str) -> dict:
f"not readable right now — the file is frozen, not gone", status=409)
try:
- path.unlink()
+ os.unlink(long_path(path))
except FileNotFoundError:
# Already gone from disk; drop the stale entry rather than refusing.
log.warning("Index named a file that is not on disk: %s", path)
@@ -104,7 +107,7 @@ async def prune_index_cache(state: dict) -> dict:
return True
if any(not r.available for r in owning):
return False
- return not path.exists()
+ return not os.path.exists(long_path(path))
paths = await cache.all_paths()
stale = await asyncio.to_thread(lambda: [p for p in paths if _is_stale(p)])
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