Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
This was referenced Oct 24, 2026
subscribe() and unsubscribe() only change scheduled_subs, the topics the caller wants. The receive loop sends the change on its next turn, up to a second later, and then copies scheduled_subs into subs, the topics the connection has been sent. When the connection closed with an error, connect() set scheduled_subs back to subs before reconnecting. That line came with "resub on reconnect" (massive-com#207), and it does resubscribe the topics that were sent. But a change made in the second before the drop had not been sent yet, so it was thrown away: a topic subscribed just before the drop was missing on the new connection, and a topic unsubscribed came back. Keep scheduled_subs and only reset subs, so the new connection subscribes to every topic the caller wants. connect() also kept subs from an earlier call. Calling it again after it returned, for example after the server closed the connection cleanly, sent no subscribe message at all, because every topic looked sent already. Reset subs at the start of every connect() call. This is one way to end up with the missing subscriptions reported in massive-com#800. The mock server now records the messages each connection receives, and fails the connection on a DROP.X subscription. The shared test setup waits for the server to start, as test_status did.
chipkent
force-pushed
the
fix/ws-keep-subscriptions-on-reconnect
branch
from
October 24, 2026 14:54
4c8e194 to
1f2d987
Compare
This was referenced Oct 24, 2026
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.
Fixes #<issue: F2-keep>
Related to massive-com#800.
subscribe()only changesscheduled_subs. The receive loop sends the change on its next turn, up to a second later, and then copies it intosubs, the topics sent.1. Changes made just before a drop are lost. After an abnormal close,
connect()ranself.scheduled_subs = set(self.subs)(from massive-com#207). That resubscribes what was sent, but throws away changes not sent yet: a topic subscribed just before the drop is missing afterwards, and a topic unsubscribed comes back. Nowscheduled_subsis kept and onlysubsis reset.2. Calling
connect()again sends nothing.subssurvived the earlier call, so afterconnect()returned (e.g. the server closed normally), the next call thought every topic was sent already. Eachconnect()now starts with emptysubsandschedule_resub = True, so its first receive-loop turn sends everything inscheduled_subs. This is one way to get the missing subscriptions in massive-com#800.Tests
mock_server.pyrecords each connection's messages (inbox) and drops the connection onDROP.X, likeSLOW.X.BaseTestwaits for the server, asStatusTestdid.test_reconnect.pycovers both bugs; both fail onmaster.make testandmake lintpass on 3.10 and 3.14.Independent of the other PRs.