@@ -2,6 +2,7 @@ import { MongoClientBulkWriteExecutionError, ServerType } from '../../beta';
2
2
import { ClientBulkWriteCursorResponse } from '../../cmap/wire_protocol/responses' ;
3
3
import type { Server } from '../../sdam/server' ;
4
4
import type { ClientSession } from '../../sessions' ;
5
+ import { type TimeoutContext } from '../../timeout' ;
5
6
import { MongoDBNamespace } from '../../utils' ;
6
7
import { CommandOperation } from '../command' ;
7
8
import { Aspect , defineAspects } from '../operation' ;
@@ -35,14 +36,15 @@ export class ClientBulkWriteOperation extends CommandOperation<ClientBulkWriteCu
35
36
*/
36
37
override async execute (
37
38
server : Server ,
38
- session : ClientSession | undefined
39
+ session : ClientSession | undefined ,
40
+ timeoutContext : TimeoutContext
39
41
) : Promise < ClientBulkWriteCursorResponse > {
40
42
let command ;
41
43
42
44
if ( server . description . type === ServerType . LoadBalancer ) {
43
45
if ( session ) {
44
46
// Checkout a connection to build the command.
45
- const connection = await server . pool . checkOut ( ) ;
47
+ const connection = await server . pool . checkOut ( { timeoutContext } ) ;
46
48
// Pin the connection to the session so it get used to execute the command and we do not
47
49
// perform a double check-in/check-out.
48
50
session . pin ( connection ) ;
@@ -69,7 +71,13 @@ export class ClientBulkWriteOperation extends CommandOperation<ClientBulkWriteCu
69
71
server . description . maxWriteBatchSize
70
72
) ;
71
73
}
72
- return await super . executeCommand ( server , session , command , ClientBulkWriteCursorResponse ) ;
74
+ return await super . executeCommand (
75
+ server ,
76
+ session ,
77
+ command ,
78
+ timeoutContext ,
79
+ ClientBulkWriteCursorResponse
80
+ ) ;
73
81
}
74
82
}
75
83
0 commit comments