Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: disable simutanous updater download (#4254)

Peng Xiao2813ad36b8e7
diff --git a/apps/electron/src/main/updater/electron-updater.ts b/apps/electron/src/main/updater/electron-updater.ts
index 52b6a84f0d..593fd33c74 100644
--- a/apps/electron/src/main/updater/electron-updater.ts
+++ b/apps/electron/src/main/updater/electron-updater.ts
@@ -70,10 +70,13 @@ export const registerUpdater = async () => {
autoUpdater.on('checking-for-update', () => {
logger.info('Checking for update');
});
+ let downloading = false;
autoUpdater.on('update-available', info => {
logger.info('Update available', info);
- if (allowAutoUpdate) {
+ if (allowAutoUpdate && !downloading) {
+ downloading = true;
autoUpdater?.downloadUpdate().catch(e => {
+ downloading = false;
logger.error('Failed to download update', e);
});
logger.info('Update available, downloading...', info);
@@ -91,6 +94,7 @@ export const registerUpdater = async () => {
updaterSubjects.downloadProgress.next(e.percent);
});
autoUpdater.on('update-downloaded', e => {
+ downloading = false;
updaterSubjects.updateReady.next({
version: e.version,
allowAutoUpdate,