-
Notifications
You must be signed in to change notification settings - Fork 105
chore: expose webhook concurrency in env var #904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: expose webhook concurrency in env var #904
Conversation
WalkthroughA new environment variable, Changes
Sequence Diagram(s)sequenceDiagram
participant Env as Environment
participant Worker as SendWebhookWorker
Env->>Worker: Provide SEND_WEBHOOK_QUEUE_CONCURRENCY value (default 10)
Worker->>Worker: Initialize with concurrency from env
Worker->>WebhookQueue: Process webhooks with configured concurrency
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/shared/utils/env.ts (1)
97-97: Consider adding validation bounds for concurrency value.The implementation looks good and follows the established pattern. However, consider adding validation to ensure the concurrency value is a positive integer, as negative or zero values could cause issues with the BullMQ worker.
- SEND_WEBHOOK_QUEUE_CONCURRENCY: z.coerce.number().default(10), + SEND_WEBHOOK_QUEUE_CONCURRENCY: z.coerce.number().min(1).default(10),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/shared/utils/env.ts(2 hunks)src/worker/tasks/send-webhook-worker.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/shared/utils/env.ts (1)
Learnt from: d4mr
PR: thirdweb-dev/engine#897
File: src/shared/utils/env.ts:106-115
Timestamp: 2025-06-09T23:36:29.144Z
Learning: In the mine worker polling configuration, EXPERIMENTAL__MINE_WORKER_BASE_POLL_INTERVAL_SECONDS can intentionally be set higher than EXPERIMENTAL__MINE_WORKER_MAX_POLL_INTERVAL_SECONDS when combined with a low EXPERIMENTAL__MINE_WORKER_POLL_INTERVAL_SCALING_FACTOR. This creates a gradual backoff curve where the actual interval starts low (base * attempts * scaling_factor) and ramps up until capped by the max value, allowing for fine-grained control over polling behavior.
🧬 Code Graph Analysis (1)
src/worker/tasks/send-webhook-worker.ts (1)
src/shared/utils/env.ts (1)
env(23-181)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: build
- GitHub Check: lint
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
src/shared/utils/env.ts (1)
172-172: Environment variable mapping is correctly implemented.The runtime environment mapping follows the established pattern and correctly maps the environment variable to the schema definition.
src/worker/tasks/send-webhook-worker.ts (2)
26-26: Clean import of the environment configuration.The import statement is correctly added and follows the established import pattern in the codebase.
106-106: Successfully replaces hardcoded concurrency with configurable value.The change correctly replaces the hardcoded value with the environment variable, maintaining the same default behavior (10) while enabling runtime configuration. This achieves the PR objective of making webhook queue concurrency configurable.

Changes
SEND_WEBHOOK_QUEUE_CONCURRENCYto control the concurrency of the webhook sending queueHow this PR will be tested
SEND_WEBHOOK_QUEUE_CONCURRENCY=20in the environment and verify that the webhook worker uses this valueOutput
Summary by CodeRabbit