[Splash > Backend] Rewrite fail scheduling
This commit is contained in:
parent
18e13e0b1a
commit
cc8be0a36d
1 changed files with 7 additions and 10 deletions
|
@ -164,9 +164,7 @@ const updateUntilCurrent = async () => {
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('Splash', e);
|
log('Splash', e);
|
||||||
sendState('fail');
|
await new Promise(r => fail(r));
|
||||||
|
|
||||||
await new Promise(res => scheduleNextUpdate(res));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -179,8 +177,7 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only)
|
||||||
const downloads = new UIProgress(0), installs = new UIProgress(1);
|
const downloads = new UIProgress(0), installs = new UIProgress(1);
|
||||||
|
|
||||||
const handleFail = () => {
|
const handleFail = () => {
|
||||||
scheduleNextUpdate();
|
fail(check);
|
||||||
sendState('fail');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
on('update-check-finished', ({ succeeded, updateCount }) => {
|
on('update-check-finished', ({ succeeded, updateCount }) => {
|
||||||
|
@ -235,10 +232,10 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only)
|
||||||
check();
|
check();
|
||||||
};
|
};
|
||||||
|
|
||||||
const scheduleNextUpdate = (callback = moduleUpdater.checkForUpdates) => { // Used by v1 and v2, default to v1 as used more widely in it
|
const fail = (c) => {
|
||||||
updateAttempt++;
|
const s = 10;
|
||||||
|
splashState.seconds = s;
|
||||||
|
sendState('fail');
|
||||||
|
|
||||||
const wait = Math.min(updateAttempt * 10, 60);
|
setTimeout(c, s * 1000);
|
||||||
splashState.seconds = wait;
|
|
||||||
setTimeout(callback, wait * 1000);
|
|
||||||
};
|
};
|
Loading…
Reference in a new issue