mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
fix: resume the version check when third-party traffic is allowed again #903
This commit is contained in:
@@ -70,7 +70,10 @@ async function scheduleNext(delayMs: number): Promise<void> {
|
||||
|
||||
async function tick(): Promise<void> {
|
||||
const result = await checkOnce({ reason: 'scheduled' });
|
||||
const delay = result.ok ? jitteredDelay(HOUR_MS) : FAILURE_BACKOFF_MS;
|
||||
// The scheduler keeps running while third-party traffic is off, so turning
|
||||
// the switch off at runtime resumes the checks; checkOnce skips meanwhile.
|
||||
const skipped = result.error === NO_THIRD_PARTY_ERROR;
|
||||
const delay = result.ok || skipped ? jitteredDelay(HOUR_MS) : FAILURE_BACKOFF_MS;
|
||||
await scheduleNext(delay);
|
||||
}
|
||||
|
||||
@@ -80,10 +83,6 @@ export async function startScheduler(): Promise<void> {
|
||||
logger.info('version-check: scheduler not started (disabled by env)');
|
||||
return;
|
||||
}
|
||||
if (await isNoThirdPartyTrafficOn()) {
|
||||
logger.info('version-check: scheduler not started (no third-party traffic)');
|
||||
return;
|
||||
}
|
||||
const state = await loadState();
|
||||
if (!effectiveEndpoint(state)) {
|
||||
logger.info('version-check: scheduler not started (no endpoint)');
|
||||
|
||||
Reference in New Issue
Block a user