MCPcopy
hub / github.com/node-cron/node-cron / shouldRun

Method shouldRun

src/coordinator/ipc-run-coordinator.ts:37–48  ·  view source on GitHub ↗
(key: string, ttlMs: number)

Source from the content-addressed store, hash-verified

35 }
36
37 shouldRun(key: string, ttlMs: number): Promise<boolean> {
38 const reqId = createID();
39 return new Promise<boolean>((resolve, reject) => {
40 this.pending.set(reqId, (result) => {
41 // The parent reports a coordinator error by replying with `error`; reject
42 // so the runner fails closed (skips the run), mirroring the inline path.
43 if (result.error) reject(new Error(result.error));
44 else resolve(result.allowed);
45 });
46 this.channel.send?.({ type: 'coordinator:shouldRun', key, ttlMs, reqId });
47 });
48 }
49
50 onComplete(key: string): Promise<void> {
51 this.channel.send?.({ type: 'coordinator:complete', key });

Callers

nothing calls this directly

Calls 1

createIDFunction · 0.90

Tested by

no test coverage detected