Skip to content

JobRunnerOptions — @gj-kit/nest-operations-jobs

A public interface from @gj-kit/nest-operations-jobs/core. The signature below is taken directly from the 0.1.1 release declaration.

import { JobRunnerOptions } from '@gj-kit/nest-operations-jobs/core';
interface JobRunnerOptions {
readonly registry: JobRegistryView;
readonly store: JobRunStore;
/** Required: a silent runner hides exactly the failures this package exists to surface. */
readonly logger: JobLogger;
readonly clock?: JobClock | undefined;
/**
* Beat cadence, defaulting to {@link DEFAULT_HEARTBEAT_INTERVAL_MS}.
*
* **Invariant: `staleRunAfterMs` must be at least twice this value**, and
* `createJobRunner` throws `ERR_JOB_INVALID` when it is not. A liveness budget
* shorter than the beat cadence makes a perfectly healthy run look stale
* between its own beats, so any concurrent trigger reaps it and starts a
* second body — the single-execution guarantee is gone. The defaults leave a
* factor of 10.
*/
readonly heartbeatIntervalMs?: number | undefined;
/**
* Liveness budget, defaulting to {@link DEFAULT_STALE_RUN_AFTER_MS}. Sent to
* the store as a duration on every reap, and used as the runner's own patience
* for failing heartbeats: once nothing has been written for this long, the run
* aborts itself rather than wait to be reaped by another instance.
*
* Must be at least twice `heartbeatIntervalMs` — see that option. Lowering it
* for faster dead-instance recovery is the natural first tuning move, and it
* is exactly the move that voids overlap prevention if taken too far.
*/
readonly staleRunAfterMs?: number | undefined;
readonly defaultTimeoutMs?: number | undefined;
/** Defaults to `'overlap-key'`: only free the key this execution is about to claim. */
readonly reapScope?: JobReapScope | undefined;
readonly reapLimit?: number | undefined;
/**
* The deploying revision or build id, recorded on every run row so a failure
* can be tied to what was deployed. The host reads it from wherever its
* platform publishes it; this library reads no environment variable.
*/
readonly serviceRevision?: string | null | undefined;
readonly errorTextLimit?: number | undefined;
/** Run-scoped id generator for overlap suffixes. Defaults to a random UUID. */
readonly newId?: (() => string) | undefined;
}

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/nest-operations-jobs
  • Version: 0.1.1
  • Public entry: ./core
  • Source: GitHub