| 7 | * across a fleet (e.g. a Redis lock), provide one via `setRunCoordinator`. |
| 8 | */ |
| 9 | export interface RunCoordinator { |
| 10 | /** |
| 11 | * Return `true` if THIS instance should run the fire identified by `key`, |
| 12 | * `false` to skip it (another instance handles it). Throw to fail closed |
| 13 | * (the run is skipped). `ttlMs` is a safety lease hint for lease-based |
| 14 | * coordinators (a Redis lock uses it; config-based ones ignore it). |
| 15 | */ |
| 16 | shouldRun(key: string, ttlMs: number): boolean | Promise<boolean>; |
| 17 | /** |
| 18 | * Called after the run completes (success or failure); e.g. release a lock. |
| 19 | * Config-based coordinators leave it unimplemented. |
| 20 | */ |
| 21 | onComplete?(key: string): void | Promise<void>; |
| 22 | } |
| 23 | |
| 24 | /** Why a scheduled execution was skipped (carried on `execution:skipped`). */ |
| 25 | export type SkipReason = 'not-elected' | 'coordinator-error'; |
no outgoing calls
no test coverage detected