fix(cron): keep manual runs non-blocking

This commit is contained in:
Peter Steinberger
2026-02-22 19:47:41 +01:00
parent 91f75a2b33
commit 5db1ee4ec6
4 changed files with 139 additions and 7 deletions

View File

@@ -29,7 +29,7 @@ const MIN_REFIRE_GAP_MS = 2_000;
* on top of the per-provider / per-agent timeouts to prevent one stuck job
* from wedging the entire cron lane.
*/
const DEFAULT_JOB_TIMEOUT_MS = 10 * 60_000; // 10 minutes
export const DEFAULT_JOB_TIMEOUT_MS = 10 * 60_000; // 10 minutes
type TimedCronRunOutcome = CronRunOutcome &
CronRunTelemetry & {
@@ -68,7 +68,7 @@ function errorBackoffMs(consecutiveErrors: number): number {
* Handles consecutive error tracking, exponential backoff, one-shot disable,
* and nextRunAtMs computation. Returns `true` if the job should be deleted.
*/
function applyJobResult(
export function applyJobResult(
state: CronServiceState,
job: CronJob,
result: {
@@ -556,7 +556,7 @@ export async function runDueJobs(state: CronServiceState) {
}
}
async function executeJobCore(
export async function executeJobCore(
state: CronServiceState,
job: CronJob,
abortSignal?: AbortSignal,