Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
docs(single-flight): IX_MAP_LOCK_MAX_MS is time untouched, not lock age
KageBinary659208dbd2ed
diff --git a/docs/api/README.md b/docs/api/README.mdindex 307a07be..d429efbb 100644--- a/docs/api/README.md+++ b/docs/api/README.md@@ -378,7 +378,7 @@ count rather than every skip, and `skipReasons.emptyFile`, previously hardcoded| `IX_STITCH_COOLDOWN_MS` | `900000` | How long to hold off after a stitch that did not prove it stopped, measured from when the attempt ended. `0` disables the cooldown; single-flight stays. Values under ~2 min are not honoured after a killed process — see above. || `IX_STITCH_WAIT_MS` | `30000` | How long to wait for an in-flight stitch before skipping. `0` sheds immediately. || `IX_LOCK_DIR` | `$IX_HOME/locks` (`~/.ix/locks` by default) | Where the stitch lock and cooldown record live (shared with the map lock). `ix reset` clears the cooldown, so the full re-ingest that follows one is not refused by it. |-| `IX_MAP_LOCK_MAX_MS` | `1200000` | Shared with the map lock: how old a held lock must be before it is presumed abandoned and stolen. Lowering it to a few seconds so a wedged `ix map` self-heals faster also lets a second process steal the stitch lock from an in-flight stitch. The cooldown normally catches that on the next read, so it only matters together with `IX_STITCH_COOLDOWN_MS=0` — which is the one case where "single-flight stays" stops being true. |+| `IX_MAP_LOCK_MAX_MS` | `1200000` | Shared with the map lock: how long a held lock may go untouched before it is presumed abandoned and stolen (a holder touches its lock every 30 s; a lock whose pid is dead on this host is taken at once). Lowering it below 30 s so a wedged `ix map` self-heals faster also lets a second process steal the stitch lock from an in-flight stitch. The cooldown normally catches that on the next read, so it only matters together with `IX_STITCH_COOLDOWN_MS=0` — which is the one case where "single-flight stays" stops being true. |This bounds the client. Cancelling the server-side query when the client hangsup, and making the join indexed rather than a full scan, are backend concernsdiff --git a/ix-cli/src/cli/single-flight.ts b/ix-cli/src/cli/single-flight.tsindex 5ba853f0..aa0f257a 100644--- a/ix-cli/src/cli/single-flight.ts+++ b/ix-cli/src/cli/single-flight.ts@@ -19,7 +19,7 @@ import { ixHome } from "./ix-home.js";// guarantee holds no matter what launches it (hook, watcher, manual, CI). The// first invocation for a workspace takes the lock; any concurrent invocation// sees a live holder and exits quietly (coalesces) instead of piling on. A-// stale lock (dead holder, or older than IX_MAP_LOCK_MAX_MS) is stolen so a+// stale lock (dead holder, or untouched for IX_MAP_LOCK_MAX_MS) is stolen so a// crashed map never wedges future runs.//// Keeping the authority in the CLI (rather than only in a shell-hook lock)@@ -139,9 +139,10 @@ function isStale(meta: LockMeta | null, path?: string): boolean {* Returns a LockHandle on success, or null if another live invocation already* holds it — in which case the caller should coalesce (skip its own run).*- * Acquisition is atomic via O_CREAT|O_EXCL ('wx'); the classic create-exclusive- * lockfile. On contention we inspect the holder: a stale lock is removed and- * acquisition retried once.+ * Acquisition is atomic via link(): the meta is written to a private file and+ * hard-linked into place, which fails if the lock exists, like O_EXCL. On+ * contention we inspect the holder: a stale lock is removed and acquisition+ * retried once.*/export function acquireMapLock(workspaceRoot: string, label: string): LockHandle | null {return acquireLockAt(lockPathFor(workspaceRoot), label);