fix: resume the version check when third-party traffic is allowed again #903

This commit is contained in:
Linus Rath
2026-10-28 04:30:32 +01:00
parent a9c89ae7a2
commit 0b3d74aa0b
+4 -5
View File
@@ -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)');