feat: automate exact dedupe and improve web feedback

This commit is contained in:
OpenClaw Agent
2026-09-18 07:30:38 +08:00
parent 0fbadf0c9c
commit f10e92a5cd
8 changed files with 283 additions and 163 deletions
+18
View File
@@ -0,0 +1,18 @@
from __future__ import annotations
from contextlib import contextmanager
from pathlib import Path
import fcntl
@contextmanager
def exclusive(db_path: Path):
"""Cross-process lock for destructive dedupe operations."""
lock_path = Path(str(db_path) + ".lock")
lock_path.parent.mkdir(parents=True, exist_ok=True)
with lock_path.open("w") as handle:
fcntl.flock(handle.fileno(), fcntl.LOCK_EX)
try:
yield
finally:
fcntl.flock(handle.fileno(), fcntl.LOCK_UN)