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:
@@ -313,11 +313,13 @@ class SelfUpdater extends EventEmitter {
|
|||||||
|
|
||||||
// Update history
|
// Update history
|
||||||
const history = this.getUpdateHistory();
|
const history = this.getUpdateHistory();
|
||||||
const pending = history.find(h => h.status === 'pending');
|
const updated = history.filter(h => h.status === 'pending');
|
||||||
if (pending) {
|
if (updated.length > 0) {
|
||||||
pending.status = result.success ? 'success' : 'rolled-back';
|
for (const pending of updated) {
|
||||||
pending.duration = result.duration;
|
pending.status = result.success ? 'success' : 'rolled-back';
|
||||||
if (result.error) pending.error = result.error;
|
pending.duration = result.duration;
|
||||||
|
if (result.error) pending.error = result.error;
|
||||||
|
}
|
||||||
this._saveHistory(history);
|
this._saveHistory(history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user