Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/shared/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export const env = createEnv({
CUSTOM_HMAC_AUTH_CLIENT_ID: z.string().optional(),
CUSTOM_HMAC_AUTH_CLIENT_SECRET: z.string().optional(),

SEND_WEBHOOK_QUEUE_CONCURRENCY: z.coerce.number().default(10),

/**
* Experimental env vars. These may be renamed or removed in future non-major releases.
*/
Expand Down Expand Up @@ -167,6 +169,7 @@ export const env = createEnv({
process.env.EXPERIMENTAL__MINE_WORKER_MAX_POLL_INTERVAL_SECONDS,
EXPERIMENTAL__MINE_WORKER_POLL_INTERVAL_SCALING_FACTOR:
process.env.EXPERIMENTAL__MINE_WORKER_POLL_INTERVAL_SCALING_FACTOR,
SEND_WEBHOOK_QUEUE_CONCURRENCY: process.env.SEND_WEBHOOK_QUEUE_CONCURRENCY,
},
onValidationError: (error: ZodError) => {
console.error(
Expand Down
3 changes: 2 additions & 1 deletion src/worker/tasks/send-webhook-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
SendWebhookQueue,
type WebhookJob,
} from "../queues/send-webhook-queue";
import { env } from "../../shared/utils/env";

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