Skip to content

fix: resolve issues #246, #247, #248, #249 - #267

Merged
ritaifeoluwa merged 2 commits into
SmartDropLabs:mainfrom
Smartdevs17:fix/all-assigned-issues
Aug 27, 2026
Merged

fix: resolve issues #246, #247, #248, #249#267
ritaifeoluwa merged 2 commits into
SmartDropLabs:mainfrom
Smartdevs17:fix/all-assigned-issues

Conversation

@Smartdevs17

Copy link
Copy Markdown
Contributor

Changes

Closes #246
Closes #247
Closes #248
Closes #249

#246 — CORS origin validation error message

  • Added FORBIDDEN to AppError.ERROR_CODES so the CORS middleware's detailed error (including the rejected origin and allowed origins list) is properly returned as a 403 instead of silently failing at construction.
  • Updated errorHandler.js to handle 403 status codes in the non-AppError fallback path.

#247 — Webhook delivery ordering guarantee

  • Added X-SmartDrop-Sequence header to webhook deliveries so receivers can detect out-of-order events.
  • Sequence number is persisted on the delivery record and propagated through retries.
  • The existing WEBHOOK_ORDERED_DELIVERY=true env var enables sequential dispatch within a batch; by default concurrent dispatch is used with sequence numbers for ordering verification.

#248 — Graceful shutdown for WebSocket connections

  • Enhanced PriceSubscriptionManager.drain() to broadcast a server_shutdown warning message before sending close frames, giving clients time to finish in-flight work.
  • Added _draining flag that rejects new WebSocket connections during the drain period.
  • Added drain statistics tracking (warned, closed, forceClosed) exposed via drainStats getter.
  • Drain stats and connection count are now included in the /health endpoint response.

#249 — Redis connection pool exhaustion

  • Created src/utils/semaphore.js — a counting semaphore for limiting concurrent access.
  • Wrapped cache.get, cache.set, and cache.del with a concurrency semaphore (REDIS_MAX_CONCURRENT_OPS, default 50) to prevent command queue buildup.
  • Added backpressure monitoring: warns at REDIS_COMMAND_QUEUE_WARN_THRESHOLD (default 100), errors at REDIS_COMMAND_QUEUE_BACKPRESSURE_THRESHOLD (default 500).
  • Exposed getConcurrencyStats() in the cache module and /health endpoint.
  • Updated /health endpoint to include Redis concurrency stats and WebSocket drain stats.

Smartdevs17 and others added 2 commits August 27, 2026 15:38
…bs#248, SmartDropLabs#249

- SmartDropLabs#246: Add FORBIDDEN to AppError codes so CORS origin validation returns
  detailed error messages with the rejected origin
- SmartDropLabs#247: Add X-SmartDrop-Sequence header to webhook deliveries for ordering
  guarantees; sequence is persisted and propagated through retries
- SmartDropLabs#248: Enhance WebSocket graceful shutdown with pre-close warning broadcast,
  reject new connections during drain, and track drain statistics
- SmartDropLabs#249: Add Redis concurrency semaphore and backpressure to prevent connection
  pool exhaustion; expose queue depth and concurrency stats in /health endpoint
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@Smartdevs17 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ritaifeoluwa
ritaifeoluwa merged commit b070763 into SmartDropLabs:main Aug 27, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants