-
Notifications
You must be signed in to change notification settings - Fork 847
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
chore(mongodb): upgrade driver to version 2.0.0 #3108
base: main
Are you sure you want to change the base?
Conversation
@@ -188,10 +188,13 @@ func (m *Processor) ProcessBatch(ctx context.Context, batch service.MessageBatch | |||
Hint: hintJSON, | |||
} | |||
case OperationFindOne: | |||
collection := m.database.Collection(collectionStr, m.writeConcernCollectionOption) | |||
ctx, cancel := context.WithTimeout(context.Background(), m.writeConcernSpec.wTimeout) |
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.
Read timeout? Seems wrong to use a write timeout here...
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.
Or maybe we should deprecate writeConcernSpec.wTimeout
the and just use the ProcessBatch
ctx
instead. Not sure why it wasn't used before...
Same for the output since https://github.com/mongodb/mongo-go-driver/blob/v2.0.0/docs/migration-2.0.md#wtimeout
The
WTimeout
field has been removed from theWriteConcern
struct. Instead, users should define a timeout at the operation-level using a context object.
To deprecate a field, we typically remove it from everywhere except the docs (see example here and here) and mention it in the Changelog.
Looks good thanks! Looks like the linter is :blobmad: |
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.
Nice job @ooesili! I just left one small comment, but feel free to ignore it if it would cause trouble for users. Otherwise feel free to
@@ -188,10 +188,13 @@ func (m *Processor) ProcessBatch(ctx context.Context, batch service.MessageBatch | |||
Hint: hintJSON, | |||
} | |||
case OperationFindOne: | |||
collection := m.database.Collection(collectionStr, m.writeConcernCollectionOption) | |||
ctx, cancel := context.WithTimeout(context.Background(), m.writeConcernSpec.wTimeout) |
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.
Or maybe we should deprecate writeConcernSpec.wTimeout
the and just use the ProcessBatch
ctx
instead. Not sure why it wasn't used before...
Same for the output since https://github.com/mongodb/mongo-go-driver/blob/v2.0.0/docs/migration-2.0.md#wtimeout
The
WTimeout
field has been removed from theWriteConcern
struct. Instead, users should define a timeout at the operation-level using a context object.
To deprecate a field, we typically remove it from everywhere except the docs (see example here and here) and mention it in the Changelog.
SetSocketTimeout
was removed, and its usage has been replaced withSetTimeout
WriteConcern
struct no longer contains a timeout field, context is used instead, so I added a wrapper struct with this field to minimize code changesoptions
packages has been overhauled so there are a bunch of code changes around setting optionsFor more information, see this doc https://github.com/mongodb/mongo-go-driver/blob/v2.0.0/docs/migration-2.0.md