Skip to content

Commit 9a8a054

Browse files
authored
chore: expose webhook concurrency in env var (#904)
1 parent 3baf200 commit 9a8a054

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/shared/utils/env.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ export const env = createEnv({
9494
CUSTOM_HMAC_AUTH_CLIENT_ID: z.string().optional(),
9595
CUSTOM_HMAC_AUTH_CLIENT_SECRET: z.string().optional(),
9696

97+
SEND_WEBHOOK_QUEUE_CONCURRENCY: z.coerce.number().default(10),
98+
9799
/**
98100
* Experimental env vars. These may be renamed or removed in future non-major releases.
99101
*/
@@ -167,6 +169,7 @@ export const env = createEnv({
167169
process.env.EXPERIMENTAL__MINE_WORKER_MAX_POLL_INTERVAL_SECONDS,
168170
EXPERIMENTAL__MINE_WORKER_POLL_INTERVAL_SCALING_FACTOR:
169171
process.env.EXPERIMENTAL__MINE_WORKER_POLL_INTERVAL_SCALING_FACTOR,
172+
SEND_WEBHOOK_QUEUE_CONCURRENCY: process.env.SEND_WEBHOOK_QUEUE_CONCURRENCY,
170173
},
171174
onValidationError: (error: ZodError) => {
172175
console.error(

src/worker/tasks/send-webhook-worker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
SendWebhookQueue,
2424
type WebhookJob,
2525
} from "../queues/send-webhook-queue";
26+
import { env } from "../../shared/utils/env";
2627

2728
const handler: Processor<string, void, string> = async (job: Job<string>) => {
2829
const { data, webhook } = superjson.parse<WebhookJob>(job.data);
@@ -102,7 +103,7 @@ const handler: Processor<string, void, string> = async (job: Job<string>) => {
102103
// Must be explicitly called for the worker to run on this host.
103104
export const initSendWebhookWorker = () => {
104105
new Worker(SendWebhookQueue.q.name, handler, {
105-
concurrency: 10,
106+
concurrency: env.SEND_WEBHOOK_QUEUE_CONCURRENCY,
106107
connection: redis,
107108
});
108109
};

0 commit comments

Comments
 (0)