MCPcopy Create free account
hub / github.com/cedriking/spark / runPeriodically

Method runPeriodically

src/task-queue.ts:19–30  ·  view source on GitHub ↗
(task: Task, milliseconds: number)

Source from the content-addressed store, hash-verified

17 }
18
19 runPeriodically(task: Task, milliseconds: number): void {
20 let pending = false;
21 this.intervals.push(
22 setInterval(() => {
23 if (pending) return;
24 pending = true;
25 this.run(task).finally(() => {
26 pending = false;
27 });
28 }, milliseconds)
29 );
30 }
31
32 async stop() {
33 this.tasks.length = 0;

Callers 1

startMethod · 0.80

Calls 1

runMethod · 0.95

Tested by

no test coverage detected