Skip to content

✨ tweak: improve queue polling#99

Merged
warengonzaga merged 1 commit intomainfrom
fix/polling-issues
Oct 1, 2025
Merged

✨ tweak: improve queue polling#99
warengonzaga merged 1 commit intomainfrom
fix/polling-issues

Conversation

@warengonzaga
Copy link
Member

@warengonzaga warengonzaga commented Oct 1, 2025

Summary by CodeRabbit

  • New Features

    • Webhook polling interval is now configurable and defaults to 5 seconds (previously 1 second), reducing request frequency and improving efficiency.
    • Webhook consumer logs a clear success message on startup for better observability.
  • Chores

    • Internal configuration access aligned across modules to use a single source of truth for runtime settings.

@warengonzaga warengonzaga self-assigned this Oct 1, 2025
Copilot AI review requested due to automatic review settings October 1, 2025 13:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Updates the webhook consumer polling configuration to use a configurable interval instead of a hardcoded value, increasing the default polling interval from 1 second to 5 seconds for better performance.

  • Replaced hardcoded 1000ms poll interval with configurable WEBHOOK_POLL_INTERVAL from config
  • Increased default polling interval from 1000ms to 5000ms
  • Fixed import extension inconsistency in logger config

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/index.ts Added config import and replaced hardcoded poll interval with configurable value
src/config/defaults.ts Updated default webhook poll interval from 1000ms to 5000ms
src/config/logger.ts Removed .js extension from import statement for consistency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

🩹 Patch Image Built Successfully

Test this patch with Docker:

# Docker Hub
docker pull wgtechlabs/unthread-discord-bot:patch-78433d6

# GitHub Container Registry
docker pull ghcr.io/wgtechlabs/unthread-discord-bot:patch-78433d6

Deploy to Railway/Cloud for testing:

  • Image: wgtechlabs/unthread-discord-bot:patch-78433d6
  • SHA: 78433d6aa2bc5d6e96d3bb8d65a43900e58677ca
  • Built: 2025-10-01T13:01:13Z

⚡ Hotfix ready for validation in production-like environment!

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

Overview

Image reference wgtechlabs/unthread-discord-bot:latest wgtechlabs/unthread-discord-bot:pr-99-78433d6
- digest cafd84e7eb3a dfbed1d65100
- tag latest pr-99-78433d6
- provenance 9475273 78433d6
- vulnerabilities critical: 0 high: 1 medium: 2 low: 3 critical: 0 high: 0 medium: 0 low: 3
- platform linux/amd64 linux/amd64
- size 61 MB 74 MB (+13 MB)
- packages 354 359 (+5)
Base Image node:22.16-alpine3.21
also known as:
22-alpine
22-alpine3.21
jod-alpine
jod-alpine3.21
lts-alpine
lts-alpine3.21
node:22-alpine
also known as:
22-alpine3.21
jod-alpine
jod-alpine3.21
lts-alpine
lts-alpine3.21
- vulnerabilities critical: 0 high: 1 medium: 2 low: 3 critical: 0 high: 1 medium: 2 low: 3
Labels (5 changes)
  • - 3 removed
  • ± 2 changed
  • 3 unchanged
-org.opencontainers.image.created=2025-09-24T10:57:17Z
+org.opencontainers.image.created=2025-10-01T13:01:35Z
 org.opencontainers.image.description=Turn Discord servers into comprehensive support ticket hubs with real-time bidirectional communication — powered by Unthread.io.
-org.opencontainers.image.licenses=AGPL-3.0
-org.opencontainers.image.revision=94752732455cb612bee529a58e25dcfc52c755f5
+org.opencontainers.image.revision=78433d6aa2bc5d6e96d3bb8d65a43900e58677ca
 org.opencontainers.image.source=https://github.com/wgtechlabs/unthread-discord-bot
 org.opencontainers.image.title=Unthread Discord Bot
-org.opencontainers.image.url=https://github.com/wgtechlabs/unthread-discord-bot
-org.opencontainers.image.version=1.0.4
Packages and Vulnerabilities (15 package changes and 1 vulnerability changes)
  • ➕ 6 packages added
  • ➖ 1 packages removed
  • ♾️ 8 packages changed
  • 314 packages unchanged
  • ✔️ 1 vulnerabilities removed
Changes for packages of type apk (12 changes)
Package Version
wgtechlabs/unthread-discord-bot:latest
Version
wgtechlabs/unthread-discord-bot:pr-99-78433d6
alpine-base 3.21.4-r0
♾️ alpine-release 3.21.3-r0 3.21.4-r0
♾️ busybox 1.37.0-r12 1.37.0-r13
♾️ busybox-binsh 1.37.0-r12 1.37.0-r13
ca-certificates 20250619-r0
♾️ ca-certificates-bundle 20241121-r1 20250619-r0
gcc 14.2.0-r4
♾️ libcrypto3 3.3.3-r0 3.3.5-r0
♾️ libssl3 3.3.3-r0 3.3.5-r0
critical: 0 high: 1 medium: 0 low: 0
Removed vulnerabilities (1):
  • high : CVE--2025--9230
openssl 3.3.5-r0
pax-utils 1.3.8-r1
♾️ ssl_client 1.37.0-r12 1.37.0-r13
Changes for packages of type generic (1 changes)
Package Version
wgtechlabs/unthread-discord-bot:latest
Version
wgtechlabs/unthread-discord-bot:pr-99-78433d6
node 22.16.0
Changes for packages of type github (1 changes)
Package Version
wgtechlabs/unthread-discord-bot:latest
Version
wgtechlabs/unthread-discord-bot:pr-99-78433d6
node 22.16.0
Changes for packages of type npm (1 changes)
Package Version
wgtechlabs/unthread-discord-bot:latest
Version
wgtechlabs/unthread-discord-bot:pr-99-78433d6
♾️ unthread-discord-bot 1.0.4 1.1.0

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

📝 Walkthrough

Walkthrough

Sir, the update raises WEBHOOK_POLL_INTERVAL from 1000 to 5000, standardizes an import path in logger, and refactors initialization to fetch configuration via getAllConfig, wiring the webhook consumer’s pollInterval to that value and adding a success log after startup.

Changes

Cohort / File(s) Summary of Changes
Configuration defaults
src/config/defaults.ts
Updated DEFAULT_CONFIG.WEBHOOK_POLL_INTERVAL from 1000 to 5000. Exposes getAllConfig() for consumers.
Logger import normalization
src/config/logger.ts
Adjusted import path for isDevelopment from './defaults.js' to './defaults'.
Webhook consumer init
src/index.ts
Imported getAllConfig and retrieved config at startup. Replaced hard-coded pollInterval with config.WEBHOOK_POLL_INTERVAL. Added success log after starting the consumer.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed Certainly, Sir, the title “✨ tweak: improve queue polling” succinctly encapsulates the pull request’s main change by highlighting the update to polling behavior and clarifying its intent for any reviewer.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/polling-issues

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ba20c2 and 698c002.

📒 Files selected for processing (3)
  • src/config/defaults.ts (1 hunks)
  • src/config/logger.ts (1 hunks)
  • src/index.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/index.ts (2)
src/config/defaults.ts (1)
  • getAllConfig (93-104)
src/sdk/webhook-consumer/WebhookConsumer.ts (1)
  • WebhookConsumer (39-470)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-Release Security Gate
🔇 Additional comments (6)
src/config/logger.ts (1)

17-17: Sir, the import path standardization looks excellent.

Removing the explicit .js extension aligns with modern TypeScript conventions and maintains consistency across the module imports.

src/config/defaults.ts (2)

47-47: Sir, the polling interval adjustment warrants verification of latency tolerance.

Increasing the interval from 1 second to 5 seconds reduces Redis load by 80%, which is excellent for resource efficiency. However, this introduces up to 5 seconds of additional latency for webhook event processing. Please confirm this delay is acceptable for your time-sensitive workflows, particularly for user-facing Discord interactions.


93-104: Sir, the centralized configuration accessor is elegantly designed.

The getAllConfig() function provides a clean, consolidated interface for configuration retrieval with environment override support. This pattern promotes consistency and will simplify future configuration management across the application.

src/index.ts (3)

90-90: Sir, the import addition integrates seamlessly.

The getAllConfig import properly supports the configuration-driven initialization pattern introduced below.


437-443: Sir, the configuration-driven approach is precisely executed.

Retrieving the poll interval from getAllConfig() eliminates hardcoded values and ensures the webhook consumer respects environment overrides. The implementation correctly wires config.WEBHOOK_POLL_INTERVAL (defaulting to 5000ms) to the consumer's initialization.


447-447: Sir, the success log enhances operational visibility beautifully.

The added confirmation message provides clear feedback that the webhook consumer has initialized successfully, improving the developer experience during startup diagnostics.


Comment @coderabbitai help to get the list of available commands and usage tips.

@warengonzaga warengonzaga added api API integration and external services (Issues/PRs) hacktoberfest-accepted Hacktoberfest accepted (PRs) labels Oct 1, 2025
@warengonzaga warengonzaga merged commit c1dbdbc into main Oct 1, 2025
7 checks passed
@warengonzaga warengonzaga deleted the fix/polling-issues branch October 1, 2025 19:08
@coderabbitai coderabbitai bot mentioned this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api API integration and external services (Issues/PRs) hacktoberfest-accepted Hacktoberfest accepted (PRs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants