| ... | @@ -203,6 +203,7 @@ function getDestructiveMenuIcon(): Electron.NativeImage | undefined { | ... | @@ -203,6 +203,7 @@ function getDestructiveMenuIcon(): Electron.NativeImage | undefined { |
| 203 | } | 203 | } |
| 204 | } | 204 | } |
| 205 | let updatePollTimer: ReturnType<typeof setInterval> | null = null; | 205 | let updatePollTimer: ReturnType<typeof setInterval> | null = null; |
| | 206 | let updateStartupTimer: ReturnType<typeof setTimeout> | null = null; |
| 206 | let updateCheckInFlight = false; | 207 | let updateCheckInFlight = false; |
| 207 | let updateDownloadInFlight = false; | 208 | let updateDownloadInFlight = false; |
| 208 | let updaterConfigured = false; | 209 | let updaterConfigured = false; |
| ... | @@ -538,9 +539,14 @@ function configureAppIdentity(): void { | ... | @@ -538,9 +539,14 @@ function configureAppIdentity(): void { |
| 538 | } | 539 | } |
| 539 | | 540 | |
| 540 | function clearUpdatePollTimer(): void { | 541 | function clearUpdatePollTimer(): void { |
| 541 | if (!updatePollTimer) return; | 542 | if (updateStartupTimer) { |
| 542 | clearInterval(updatePollTimer); | 543 | clearTimeout(updateStartupTimer); |
| 543 | updatePollTimer = null; | 544 | updateStartupTimer = null; |
| | 545 | } |
| | 546 | if (updatePollTimer) { |
| | 547 | clearInterval(updatePollTimer); |
| | 548 | updatePollTimer = null; |
| | 549 | } |
| 544 | } | 550 | } |
| 545 | | 551 | |
| 546 | function emitUpdateState(): void { | 552 | function emitUpdateState(): void { |
| ... | @@ -570,7 +576,7 @@ function shouldEnableAutoUpdates(): boolean { | ... | @@ -570,7 +576,7 @@ function shouldEnableAutoUpdates(): boolean { |
| 570 | } | 576 | } |
| 571 | | 577 | |
| 572 | async function checkForUpdates(reason: string): Promise<void> { | 578 | async function checkForUpdates(reason: string): Promise<void> { |
| 573 | if (!updaterConfigured || updateCheckInFlight) return; | 579 | if (isQuitting || !updaterConfigured || updateCheckInFlight) return; |
| 574 | if ( | 580 | if ( |
| 575 | updateState.status === "downloading" || | 581 | updateState.status === "downloading" || |
| 576 | updateState.status === "downloaded" || | 582 | updateState.status === "downloaded" || |
| ... | @@ -739,10 +745,13 @@ function configureAutoUpdater(): void { | ... | @@ -739,10 +745,13 @@ function configureAutoUpdater(): void { |
| 739 | console.info(`[desktop-updater] Update downloaded: ${info.version}`); | 745 | console.info(`[desktop-updater] Update downloaded: ${info.version}`); |
| 740 | }); | 746 | }); |
| 741 | | 747 | |
| 742 | const startupTimer = setTimeout(() => { | 748 | clearUpdatePollTimer(); |
| | 749 | |
| | 750 | updateStartupTimer = setTimeout(() => { |
| | 751 | updateStartupTimer = null; |
| 743 | void checkForUpdates("startup"); | 752 | void checkForUpdates("startup"); |
| 744 | }, AUTO_UPDATE_STARTUP_DELAY_MS); | 753 | }, AUTO_UPDATE_STARTUP_DELAY_MS); |
| 745 | startupTimer.unref(); | 754 | updateStartupTimer.unref(); |
| 746 | | 755 | |
| 747 | updatePollTimer = setInterval(() => { | 756 | updatePollTimer = setInterval(() => { |
| 748 | void checkForUpdates("poll"); | 757 | void checkForUpdates("poll"); |