Skip to content

Commit cd3c105

Browse files
committed
move cron init workers
1 parent 22010ae commit cd3c105

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

src/worker/queues/cancelRecycledNoncesQueue.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,5 @@ export class CancelRecycledNoncesQueue {
1010

1111
constructor() {
1212
CancelRecycledNoncesQueue.q.setGlobalConcurrency(1);
13-
CancelRecycledNoncesQueue.q.add("cron", "", {
14-
repeat: { pattern: "* * * * *" },
15-
jobId: "cron",
16-
});
1713
}
1814
}
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Queue } from "bullmq";
2-
import { env } from "../../utils/env";
32
import { redis } from "../../utils/redis/redis";
43
import { defaultJobOptions } from "./queues";
54

@@ -10,14 +9,6 @@ export class PruneTransactionsQueue {
109
});
1110

1211
constructor() {
13-
if (env.ENGINE_MODE === "server_only") {
14-
return;
15-
}
16-
1712
PruneTransactionsQueue.q.setGlobalConcurrency(1);
18-
PruneTransactionsQueue.q.add("cron", "", {
19-
repeat: { pattern: "*/10 * * * *" },
20-
jobId: "cron",
21-
});
2213
}
2314
}

src/worker/tasks/cancelRecycledNoncesWorker.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import { logWorkerExceptions } from "../queues/queues";
1010

1111
// Must be explicitly called for the worker to run on this host.
1212
export const initCancelRecycledNoncesWorker = () => {
13+
CancelRecycledNoncesQueue.q.add("cron", "", {
14+
repeat: { pattern: "* * * * *" },
15+
jobId: "cancel-recycled-nonces-cron",
16+
});
17+
1318
const _worker = new Worker(CancelRecycledNoncesQueue.q.name, handler, {
1419
connection: redis,
1520
concurrency: 1,

src/worker/tasks/migratePostgresTransactionsWorker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const initMigratePostgresTransactionsWorker = async () => {
2424
if (config.minedTxListenerCronSchedule) {
2525
MigratePostgresTransactionsQueue.q.add("cron", "", {
2626
repeat: { pattern: config.minedTxListenerCronSchedule },
27-
jobId: "cron",
27+
jobId: "migrate-postgres-transactions-cron",
2828
});
2929
}
3030

src/worker/tasks/pruneTransactionsWorker.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const handler: Processor<any, void, string> = async (job: Job<string>) => {
1414

1515
// Must be explicitly called for the worker to run on this host.
1616
export const initPruneTransactionsWorker = () => {
17+
PruneTransactionsQueue.q.add("cron", "", {
18+
repeat: { pattern: "*/10 * * * *" },
19+
jobId: "prune-transactions-cron",
20+
});
21+
1722
const _worker = new Worker(PruneTransactionsQueue.q.name, handler, {
1823
concurrency: 1,
1924
connection: redis,

0 commit comments

Comments
 (0)