chore: clarify maintenance scheduling after interval removal

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-30 23:07:34 -05:00
1 parent 7be7896b84
commit 306f7ea459
2 files changed
+3 -8

No files matched your search

-6
View File
@@ -1786,12 +1786,6 @@ async function startServerWithDatabaseTeardown(
if (config.heartbeatSchedulerEnabled) await heartbeat.registerStoppedInstructionCollectionWork(deliveryWork,
() => !isIdleTaskDrainActive() && !heartbeatSchedulerStopped && !isWarmStandby()).ready;
// Startup housekeeping: provider and connection sweeps that every timer tick
// repeats and that neither serving requests nor run recovery depends on.
// Readiness does not wait for it. It is tracked as scheduler work, so idle
// sleep and shutdown wait for it. Each step logs its own failure and the
// next step still runs. The scheduler interval starts after it, so the login
// reapers and the lease cleanup still finish before the first timer tick.
const runStartupHousekeeping = async () => {
const step = (name: string, work: () => Promise<unknown>) =>
work().catch((err: unknown) => {
+3 -2
View File
@@ -7,12 +7,13 @@ export function registerDecisionTargetWork(
service: Pick<ReturnType<typeof decisionService>, "sweepInvalidTargets" | "decisionTargetsChanged" | "hasDecisionTargetWork">,
canRun: () => boolean,
) {
const retryMs = 30_000;
return coordinator.register(DELIVERY_QUEUES.decisionTargets, {
retryMs: 30_000,
retryMs,
pausePassiveMaintenance: true,
onSettled: service.decisionTargetsChanged,
run: signal => canRun() ? service.sweepInvalidTargets(new Date(), signal) : Promise.resolve(),
hasPending: async () => canRun() && service.hasDecisionTargetWork(),
nextRunAt: () => service.hasDecisionTargetWork() ? Date.now() + 30_000 : null,
nextRunAt: () => service.hasDecisionTargetWork() ? Date.now() + retryMs : null,
});
}