File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -540,7 +540,12 @@ export type {
540540export type { InsertManyResult , InsertOneOptions , InsertOneResult } from './operations/insert' ;
541541export type { CollectionInfo , ListCollectionsOptions } from './operations/list_collections' ;
542542export type { ListDatabasesOptions , ListDatabasesResult } from './operations/list_databases' ;
543- export type { AbstractOperation , Hint , OperationOptions } from './operations/operation' ;
543+ export type {
544+ AbstractOperation ,
545+ Hint ,
546+ OperationOptions ,
547+ RetryContext
548+ } from './operations/operation' ;
544549export type { ProfilingLevelOptions } from './operations/profiling_level' ;
545550export type { RemoveUserOptions } from './operations/remove_user' ;
546551export type { RenameOptions } from './operations/rename' ;
Original file line number Diff line number Diff line change @@ -254,7 +254,10 @@ async function executeOperationWithRetries<
254254 2 // backoff rate
255255 ) ;
256256
257- const retryContext = new RetryContext ( willRetry , timeoutContext . csotEnabled ( ) ? Infinity : 2 ) ;
257+ const retryContext = new RetryContext (
258+ willRetry ,
259+ willRetry ? ( timeoutContext . csotEnabled ( ) ? Infinity : 2 ) : 1
260+ ) ;
258261
259262 for ( ; retryContext . shouldRetry ( ) ; retryContext . recordFailure ( previousOperationError ) ) {
260263 if ( previousOperationError ) {
@@ -266,14 +269,18 @@ async function executeOperationWithRetries<
266269 } ) ;
267270 }
268271
272+ // TODO: think about whether or not willRetry checks are necessary here.
269273 const isRetryable =
270274 // bulk write commands are retryable if all operations in the batch are retryable
271- ( operation . hasAspect ( Aspect . COMMAND_BATCHING ) && operation . canRetryWrite ) ||
275+ ( willRetryWrite &&
276+ operation . hasAspect ( Aspect . COMMAND_BATCHING ) &&
277+ operation . canRetryWrite ) ||
272278 // if we have a retryable read or write operation, we can retry
273279 ( hasWriteAspect && willRetryWrite && isRetryableWriteError ( previousOperationError ) ) ||
274280 ( hasReadAspect && willRetryRead && isRetryableReadError ( previousOperationError ) ) ||
275281 // if we have a retryable, system overloaded error, we can retry
276- ( previousOperationError . hasErrorLabel ( MongoErrorLabel . SystemOverloadedError ) &&
282+ ( willRetry &&
283+ previousOperationError . hasErrorLabel ( MongoErrorLabel . SystemOverloadedError ) &&
277284 previousOperationError . hasErrorLabel ( MongoErrorLabel . RetryableError ) ) ;
278285
279286 if ( ! isRetryable ) {
Original file line number Diff line number Diff line change 1- import { type Connection , type MongoError , MongoErrorLabel } from '..' ;
1+ import { type Connection , type MongoError } from '..' ;
22import { type BSONSerializeOptions , type Document , resolveBSONOptions } from '../bson' ;
33import { type MongoDBResponse } from '../cmap/wire_protocol/responses' ;
4+ import { MongoErrorLabel } from '../error' ;
45import { type Abortable } from '../mongo_types' ;
56import { ReadPreference , type ReadPreferenceLike } from '../read_preference' ;
67import type { Server , ServerCommandOptions } from '../sdam/server' ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function* walk(root) {
1515 }
1616}
1717
18- describe ( 'importing mongodb driver' , ( ) => {
18+ describe . only ( 'importing mongodb driver' , ( ) => {
1919 const sourceFiles = walk ( path . resolve ( __dirname , '../../../src' ) ) ;
2020
2121 for ( const sourceFile of sourceFiles ) {
You can’t perform that action at this time.
0 commit comments