Repository navigation
RDBC-1166 Keep an idle subscription worker connected instead of reconnecting - #321
Merged
Merged
Conversation
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.
An idle subscription worker now stays connected in WaitingForDocuments instead of reconnecting every few seconds.
SubscriptionWorkerwaits for the next batch with no time limit, as the C# worker does, and checks every second whether it was closed. A wait without documents no longer raises a retry, an unexpected error or a new established connection.SubscriptionWorkerOptions.connection_stream_timeout(default 30 s, minimum 15 s, C#ConnectionStreamTimeout), set as the socket timeout. The server sends a heartbeat every 3 to 5 seconds, so a silent connection is lost. Without it, a connection that died without a FIN or RST would block the worker and it would never fail over. The option is client side and not sent to the server.ConnectionError. The read used to loop on the empty receive, and only the old timeout ended that loop. The receive buffer is cleared on every new connection, so a partial message from a failed connection does not corrupt the next one.ravendb/tests/issue_tests/test_RDBC_1166.py. With a 1 s retry interval, an idle subscription keeps WaitingForDocuments for 6 s, with one connection, no retry and no unexpected error, and still receives the next document. Tests without a server cover the wait, close, a failed read, a closed connection and the option.black --check .passed. The 14 tests without a server pass, and the closed connection test fails on the previous worker code. The server tests run only in CI, because no test server was available locally.Ticket: RDBC-1166
C# change: none
SDK Sync Agent