fix(self-updater): clear all pending history entries, not just one

checkPostUpdateResult() used history.find() which only ever updated a
single pending entry. When multiple update attempts stacked up, the
extra pending entries stayed stuck in 'pending' forever even though
the actual update completed. Switch to filter() + loop to clear all
matching entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-06 01:58:44 -07:00
parent a216dd882d
commit 6abba43a80

View File

@@ -313,11 +313,13 @@ class SelfUpdater extends EventEmitter {
// Update history
const history = this.getUpdateHistory();
const pending = history.find(h => h.status === 'pending');
if (pending) {
const updated = history.filter(h => h.status === 'pending');
if (updated.length > 0) {
for (const pending of updated) {
pending.status = result.success ? 'success' : 'rolled-back';
pending.duration = result.duration;
if (result.error) pending.error = result.error;
}
this._saveHistory(history);
}