Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: expire stale iCloud download cooldown entries

Adam Eivy1c164a882f2b
diff --git a/server/lib/icloudFile.js b/server/lib/icloudFile.js
index f9f4d36aac..fddc237070 100644
--- a/server/lib/icloudFile.js
+++ b/server/lib/icloudFile.js
@@ -346,7 +346,10 @@ export function requestMaterialization(path, options = {}) {
// check above and this reservation.
if (retryAfterExit) {
pendingDownloads.set(path, child);
- lastRequestAt.set(path, Date.now());
+ const now = Date.now();
+ // Sweep expired entries so a vault walk over many distinct paths can't grow the map unbounded.
+ for (const [p, at] of lastRequestAt) if (now - at >= REQUEST_COOLDOWN_MS) lastRequestAt.delete(p);
+ lastRequestAt.set(path, now);
}
// Release only the entry THIS child owns (see the map's comment above). A no-op
// for an untracked (pin) request, which was never added to the set.