Skip to content

RDBC-1166 Keep an idle subscription worker connected instead of reconnecting - #321

Merged
poissoncorp merged 1 commit into
ravendb:v7.2from
poissoncorp:sdk-sync/RDBC-1166
Oct 23, 2026
Merged

poissoncorp merged 1 commit into
ravendb:v7.2from
poissoncorp:sdk-sync/RDBC-1166

Conversation

@poissoncorp

Copy link
Copy Markdown
Contributor

An idle subscription worker now stays connected in WaitingForDocuments instead of reconnecting every few seconds.

  • Changed: SubscriptionWorker waits 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.
  • Changed: new option 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.
  • Changed: a connection closed by the server now raises 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.
  • Tests: 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.
  • Checks: 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

@poissoncorp poissoncorp added the sdk-sync Port of C# client changes from an SDK sync task label Oct 22, 2026
@poissoncorp
poissoncorp merged commit a29bd7b into ravendb:v7.2 Oct 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk-sync Port of C# client changes from an SDK sync task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant