-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(NODE-5682): set maxTimeMS on commands and preempt I/O #4174
Conversation
dca1a9c
to
723e160
Compare
de93db9
to
4c04b2a
Compare
4c04b2a
to
7c79517
Compare
@@ -416,6 +417,11 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> { | |||
...options | |||
}; | |||
|
|||
if (options.timeoutContext?.csotEnabled()) { | |||
const { maxTimeMS } = options.timeoutContext; | |||
if (maxTimeMS > 0 && Number.isFinite(maxTimeMS)) cmd.maxTimeMS = maxTimeMS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused why this logic is necessary - if the remaining timeoutMS is less than minRoundTripTime, we're supposed to throw and exit. So maxTimeMS should never be negative here - right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, but this is a check for greater than 0, so it confirms that maxTimeMS does not equal 0. The checks for if we should throw are colocated with the write/read steps.
test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts
Show resolved
Hide resolved
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Co-authored-by: Warren James <[email protected]>
Description
What is changing?
maxTimeMS
field to commands when CSOT is enabledIs there new documentation needed for these changes?
No
What is the motivation for this change?
Part of the goal of CSOT. This enables the actual interruption of operations, and hints to the server (through maxTimeMS) how long it should permit an operation to run for.
Double check the following
npm run check:lint
scripttype(NODE-xxxx)[!]: description
feat(NODE-1234)!: rewriting everything in coffeescript