콘텐츠로 이동

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

@gj-kit/nest-operations-jobs에서 공개하는 interface입니다. package version 0.1.1의 release declaration을 그대로 표시합니다.

import { JobRunnerOptions } from '@gj-kit/nest-operations-jobs';
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;
}

이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.

  • 패키지: @gj-kit/nest-operations-jobs
  • 버전: 0.1.1
  • 공개 entry: .
  • 소스: GitHub