mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +01:00
restart interval in checkForUpdates if update setting changes
This commit is contained in:
parent
acb6a87ca4
commit
5f229048be
@ -75,14 +75,15 @@ export class Updater {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the auto update check interval.
|
* Starts the auto update check interval.
|
||||||
|
* @param [runCheckNow=true] Determines whether the update check should run immediately. Defaults to true.
|
||||||
* @returns The timeout object for the auto update checker.
|
* @returns The timeout object for the auto update checker.
|
||||||
*/
|
*/
|
||||||
startAutoUpdateInterval(): NodeJS.Timeout {
|
startInterval(runCheckNow = true): NodeJS.Timeout {
|
||||||
// check for updates right away and keep checking later
|
// check for updates right away and keep checking later
|
||||||
this.checkForUpdates(false);
|
if (runCheckNow) this.checkForUpdates(false);
|
||||||
return setInterval(() => {
|
return setInterval(() => {
|
||||||
this.checkForUpdates(false);
|
this.checkForUpdates(false);
|
||||||
}, 600000); // intervals are unreliable when an app is suspended so we will check every 10 mins if an hour has passed.
|
}, 600000); // intervals are unreliable when an app is suspended so we will check every 10 mins if the interval has passed.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,6 +98,8 @@ export class Updater {
|
|||||||
console.log("Auto update is disabled in settings. Removing the auto update interval.");
|
console.log("Auto update is disabled in settings. Removing the auto update interval.");
|
||||||
clearInterval(this.interval);
|
clearInterval(this.interval);
|
||||||
this.interval = null;
|
this.interval = null;
|
||||||
|
} else if (!this.interval && autoUpdateOpts.enabled) {
|
||||||
|
this.startInterval(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
@ -187,7 +190,7 @@ export async function configureAutoUpdater() {
|
|||||||
if (autoUpdateEnabled && updater?.interval == null) {
|
if (autoUpdateEnabled && updater?.interval == null) {
|
||||||
try {
|
try {
|
||||||
console.log("configuring auto update interval");
|
console.log("configuring auto update interval");
|
||||||
updater?.startAutoUpdateInterval();
|
updater?.startInterval();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("error configuring auto update interval", e.toString());
|
console.log("error configuring auto update interval", e.toString());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user