Conversation
Add Session.cancel() for best-effort cancellation of in-flight queries. Opens a separate TCP connection via _CancelSender to send a PostgreSQL CancelRequest (16 bytes: length, magic 80877102, pid, secret key). When the session uses SSLRequired, the cancel connection negotiates SSL first. Fire-and-forget — failures are silently ignored. Group connection parameters (auth, host, service, ssl_mode) into a new ServerConnectInfo val class. Session.create() now takes ServerConnectInfo as its first parameter instead of individual connection arguments. This is a breaking constructor change. Design: #88
6eb2f99 to
9ddbc5d
Compare
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.
Implements
Session.cancel()for requesting cancellation of in-flight queries. PostgreSQL requires cancel requests on a separate TCP connection, so cancellation spawns a fire-and-forget_CancelSenderactor that connects, sends the 16-byte CancelRequest (with the process ID and secret key from BackendKeyData), and closes. When the session usesSSLRequired, the cancel connection performs SSL negotiation before sending the request.cancel()follows the same "never illegal" contract asclose()— safe to call in any session state, no-op if no query is in flight. Cancellation is best-effort; if honored, the query'sResultReceivergetspg_query_failedwith SQLSTATE 57014.Design: #88