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.
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
refactor(NODE-6187): refactor to use TimeoutContext abstraction #4131
refactor(NODE-6187): refactor to use TimeoutContext abstraction #4131
Changes from 12 commits
5c945e5
4149b32
8bcff1f
bcbbc45
6fe0c86
47ad495
bb5c7d0
08651b6
f8ddf6a
9936f3b
ed637ed
10dd2a1
8a770a8
926e61b
8ac2b7e
89cb002
c3b15ec
c9b217e
55a139c
db06d9f
d2c3878
e200944
2461b12
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Just out of curiosity - why are we instantiating a timeout here and not in
resolveOptions
?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.
My intention was that we construct exactly one
TimeoutContext
per operation with a lifetime equal to that of the operation. The first convergent place we have access to both the client and operation options would be inexecuteOperation
, but the absolute first place is in each of our operation helper methods (insertOne, updateOne, etc).I am open to updating our
AbstractOperation
constructor to accept the client options we'd need to construct theTimeoutContext
and updating these methods since that would be cleaner and make clear that each operation "owns" itsTimeoutContext
.Wouldn't constructing the
TimeoutContext
inresolveOptions
lead to multipleTimeoutContext
objects being constructed that likely wouldn't be used.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.
Yeah, you're right that resolveOptions would lead to instantiation of timeouts we don't need, specifically when we construct dbs and collections. I'm not sure an operation owning a timeout context is the right choice either - I think that cursors / change streams will need to "own" their timeout context and they'll perform multiple operations inside the same context. Maybe we can leave it as-is for now and reconsider once we've implemented CSOT for cursors.
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.
NOTE: This is marked with a non-null assertion because the field will be set during execute_operation and only referenced within that function in the following places at which point, if it is not defined, this would indicate a bug in the driver. I can add an inline comment explaining this
Topology.selectServer
Server.command
ConnectionPool.checkOut
Connection.command
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.
there are no instances in the driver where we don't pass options into this method