mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 02:13:00 +08:00
fix: disable simutanous updater download (#4254)
This commit is contained in:
@@ -70,10 +70,13 @@ export const registerUpdater = async () => {
|
|||||||
autoUpdater.on('checking-for-update', () => {
|
autoUpdater.on('checking-for-update', () => {
|
||||||
logger.info('Checking for update');
|
logger.info('Checking for update');
|
||||||
});
|
});
|
||||||
|
let downloading = false;
|
||||||
autoUpdater.on('update-available', info => {
|
autoUpdater.on('update-available', info => {
|
||||||
logger.info('Update available', info);
|
logger.info('Update available', info);
|
||||||
if (allowAutoUpdate) {
|
if (allowAutoUpdate && !downloading) {
|
||||||
|
downloading = true;
|
||||||
autoUpdater?.downloadUpdate().catch(e => {
|
autoUpdater?.downloadUpdate().catch(e => {
|
||||||
|
downloading = false;
|
||||||
logger.error('Failed to download update', e);
|
logger.error('Failed to download update', e);
|
||||||
});
|
});
|
||||||
logger.info('Update available, downloading...', info);
|
logger.info('Update available, downloading...', info);
|
||||||
@@ -91,6 +94,7 @@ export const registerUpdater = async () => {
|
|||||||
updaterSubjects.downloadProgress.next(e.percent);
|
updaterSubjects.downloadProgress.next(e.percent);
|
||||||
});
|
});
|
||||||
autoUpdater.on('update-downloaded', e => {
|
autoUpdater.on('update-downloaded', e => {
|
||||||
|
downloading = false;
|
||||||
updaterSubjects.updateReady.next({
|
updaterSubjects.updateReady.next({
|
||||||
version: e.version,
|
version: e.version,
|
||||||
allowAutoUpdate,
|
allowAutoUpdate,
|
||||||
|
|||||||
Reference in New Issue
Block a user