feat(NODE-7467): make token bucket optional in client backpressure#4878
Merged
feat(NODE-7467): make token bucket optional in client backpressure#4878
Conversation
4 tasks
783489b to
daaefd8
Compare
Contributor
|
@tadjik1 With the specific spec PR and the whole of backpressure now on main in the specifications repo is this ready? :) |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for the client backpressure spec update where the token bucket mechanism is optional (disabled by default) and controlled via a new adaptiveRetries option.
Changes:
- Introduces
adaptiveRetriesas a parsed URI/client option with a default offalse. - Gates token-bucket deposit/consume behavior during overload retries behind
adaptiveRetries. - Adds unit/integration/spec tests covering option parsing and retry behavior (including max retry count and token bucket limiting).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/connection_string.ts |
Adds adaptiveRetries to connection string option descriptors with default false. |
src/mongo_client.ts |
Exposes adaptiveRetries on MongoClientOptions and makes it required on parsed MongoOptions. |
src/sdam/topology.ts |
Plumbs adaptiveRetries into TopologyOptions for downstream retry behavior checks. |
src/operations/execute_operation.ts |
Makes token bucket accounting/enforcement conditional on adaptiveRetries. |
test/unit/connection_string.test.ts |
Verifies adaptiveRetries default and enabling via URI/options. |
test/tools/uri_spec_runner.ts |
Adds adaptiveRetries to the URI spec runner’s directly-mapped option assertions. |
test/spec/uri-options/client-backpressure-options.yml |
New URI option spec cases for adaptiveRetries parsing and invalid values. |
test/spec/uri-options/client-backpressure-options.json |
JSON equivalent of the new adaptiveRetries URI spec cases. |
test/integration/client-backpressure/client-backpressure.prose.test.ts |
Updates/adds prose tests for token bucket enforcement and overload retry limits. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nbbeeken
previously approved these changes
Mar 9, 2026
dariakp
requested changes
Mar 10, 2026
test/integration/client-backpressure/client-backpressure.prose.test.ts
Outdated
Show resolved
Hide resolved
dariakp
approved these changes
Mar 10, 2026
nbbeeken
approved these changes
Mar 10, 2026
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.
Description
Summary of Changes
Node.js implementation of recent addition into client backpressure spec (token bucket is optional and disabled by default).
Spec PR: mongodb/specifications#1902
Notes for Reviewers
What is the motivation for this change?
Release Highlight
Release notes highlight
Double check the following
npm run check:lint)type(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript