Repository navigation
feat(q): connect_opts chooses the keepalive - #23
Merged
Merged
Conversation
- QConnection::connect_opts takes ConnectOpts: credentials, a timeout and a Keepalive, which is Auto, Off or Budget(Duration), mirroring rayforce-q's q_connect_opts and the core's ray_ipc_connect_opts. - connect and connect_with keep their signatures and get Auto, so no caller breaks. - A zero timeout or budget is refused rather than passed on: the C side reads 0 as no timeout or as the default keepalive. Past i32::MAX ms is refused too, the most an int carries. - The timeout and the keepalive are both int ms at the C call, so a test against a silent peer proves they are not swapped: swapped, it waits out the 30 s budget instead of the 200 ms timeout.
Collaborator
|
Thanks Ihor, this is a really nice addition: it finally lets a caller say how soon a silent peer counts as dead, and the zero/overflow checks before the C call are exactly the kind of thing that saves a bad afternoon later. Ran the workspace tests, clippy, fmt and the vendored-pin check locally on macOS, all green, and CI agrees. Merging. |
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.
Runs on what
masteralready pins (core v3.0.1, rayforce-q 2.6.0); no submodule moves. One commit on top of 1.4.0.What
QConnection::connect_opts(host, port, &ConnectOpts)opens a connection with the keepalive chosen.ConnectOptsholdsuser,password,timeout: Option<Duration>andkeepaliveKeepaliveisAuto(the core's 60 s default),Off, orBudget(Duration), the same three choices as the core'sray_ipc_connect_optsconnectandconnect_withkeep their signatures and getAuto, which is whatq_connectalready does, so no caller changesrayforce-sysbindsq_connect_optsand theQ_KEEPALIVE_AUTO/Q_KEEPALIVE_OFFconstantsWhy
rayforce-q 2.6.0 (RayforceDB/rayforce-q#24) added
q_connect_opts, so a client can say how soon a silent peer counts as dead. The crate only reachesq_connect, which always picksAuto. A subscription that only receives, behind a VPN tunnel reaped without a FIN, is noticed about 60 s late onAutoand has no bound on unacknowledged data. A caller that needs it sooner has no safe way to ask for it.Checks before the call
RayError::binding. The C side reads 0 as "no timeout" or "the default keepalive", the opposite of what a zero asks for.NoneandOffare how to say thosei32::MAXms is refused, because the C side takes anintTests
Five in
rayforce/tests/q.rs, against the mock Q server:intms at the C call, so if they were swapped this would still compile, and the test would wait out the budget insteadi32::MAXms and a zero timeout are each refused before connectingcargo test --workspace,cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --checkandscripts/check-vendored-pin.shpass locally on macOS.mkdocs buildwas not run.Limits
TCP_USER_TIMEOUT, so a live peer that stops reading for that long fails the connection too