fix(ws): report actually subscribed channels in legacy subscribe response#163
fix(ws): report actually subscribed channels in legacy subscribe response#1630x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
Conversation
…onse The legacy subscribe handler (single-slab backward compatibility path) always sent the full 3-channel array in the response, even when globalSubscriptionCount or per-client limits caused the loop to break early. Clients believed they were subscribed to all channels but silently missed trade or funding updates — a silent data loss scenario. The modern subscribe handler already correctly tracks and returns only the channels that were actually added. This fix applies the same pattern to the legacy handler: - Track subscribed channels in a separate array - Only add client to slab map if at least one channel succeeded - Return only actually-subscribed channels in the response - Send an error message when limits cause partial subscription Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 13 minutes and 56 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
price,trades,funding) in thesubscribedresponse, even whenMAX_GLOBAL_SUBSCRIPTIONSorMAX_SUBSCRIPTIONS_PER_CLIENTcaused the loop to break early. Clients believed they were fully subscribed but silently missed trade or funding updates — a silent data loss scenario.Context
The modern subscribe handler (channel-array based) already does this correctly — it builds a
subscribedaccumulator and returns only that. This fix brings the legacy handler to parity.Changes
src/routes/ws.ts: Legacy subscribe loop now trackssubscribed[], only adds to slab map if >= 1 channel succeeded, returns actual subscriptions, and sends error on partial failure.Test plan
tsc --noEmitpassesvitest runpasses (186/186 tests)🤖 Generated with Claude Code