Isolate updater staging retries - #316
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e71e7d4b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!existingCacheTrusted) { | ||
| temporaryPaths.root = path.join(paths.cacheRoot, `.tmp-update-${Date.now()}-${process.pid}`) | ||
| temporaryPaths.installDir = `${paths.installDir}.partial` | ||
| temporaryPaths.installDir = `${paths.installDir}.partial-${process.pid}-${randomUUID()}` |
There was a problem hiding this comment.
Reclaim abandoned per-attempt staging directories
If the process is killed or the machine reboots after extraction begins, this UUID-suffixed directory survives, and the next retry now stages elsewhere instead of removing it as the former fixed .partial path did. pruneOldVersions treats every directory under versions/ as a version and retains the five newest, so even one interrupted attempt can leave an almost-complete app bundle consuming disk indefinitely, while repeated interruptions can also displace real cached versions from the retention set; remove stale matching staging directories or exclude and delete them during pruning.
Useful? React with 👍 / 👎.
Summary
Why
The update lock was released before outer cleanup removed the shared
.partialdirectory. A waiting retry could acquire the lock and begin staging while the previous attempt was still recursively deleting that same path. Unique staging directories remove the cross-attempt collision.Validation