Skip to content

Commit

Permalink
Merge pull request #72 from moreal/bugfix/delay-when-skip
Browse files Browse the repository at this point in the history
Force to wait 1s after task
  • Loading branch information
moreal authored Dec 4, 2023
2 parents 7467985 + c80ad93 commit 740f862
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sync/processor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { delay } from "../utils/delay";

export class Processor {
private running: boolean;

Expand All @@ -10,6 +12,14 @@ export class Processor {
while (this.running) {
await this.tasks[cur]();
cur = (cur + 1) % this.tasks.length;

try {
await delay(1000);
} catch {
console.error(
"Ignore errors from calling delay() in Processor.start()",
);
}
}

console.debug("Processor.start() loop ended");
Expand Down

0 comments on commit 740f862

Please sign in to comment.