fix: resolve issues #246, #247, #248, #249 - #267
Merged
ritaifeoluwa merged 2 commits intoAug 27, 2026
Conversation
…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
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Closes #246
Closes #247
Closes #248
Closes #249
#246 — CORS origin validation error message
FORBIDDENtoAppError.ERROR_CODESso 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.errorHandler.jsto handle 403 status codes in the non-AppError fallback path.#247 — Webhook delivery ordering guarantee
X-SmartDrop-Sequenceheader to webhook deliveries so receivers can detect out-of-order events.WEBHOOK_ORDERED_DELIVERY=trueenv 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
PriceSubscriptionManager.drain()to broadcast aserver_shutdownwarning message before sending close frames, giving clients time to finish in-flight work._drainingflag that rejects new WebSocket connections during the drain period.drainStatsgetter./healthendpoint response.#249 — Redis connection pool exhaustion
src/utils/semaphore.js— a counting semaphore for limiting concurrent access.cache.get,cache.set, andcache.delwith a concurrency semaphore (REDIS_MAX_CONCURRENT_OPS, default 50) to prevent command queue buildup.REDIS_COMMAND_QUEUE_WARN_THRESHOLD(default 100), errors atREDIS_COMMAND_QUEUE_BACKPRESSURE_THRESHOLD(default 500).getConcurrencyStats()in the cache module and/healthendpoint./healthendpoint to include Redis concurrency stats and WebSocket drain stats.