@@ -58,7 +58,11 @@ type ResultTypeFromOperation<TOperation> =
58
58
export async function executeOperation <
59
59
T extends AbstractOperation < TResult > ,
60
60
TResult = ResultTypeFromOperation < T >
61
+ < << << << HEAD
61
62
> ( client : MongoClient , operation : T , timeoutContext ?: TimeoutContext | null ) : Promise < TResult > {
63
+ = === ===
64
+ > ( client : MongoClient , operation : T , timeoutContext ?: TimeoutContext ) : Promise < TResult > {
65
+ >>> >>> > e04694c3b ( refactor ( NODE - 6187 ) : refactor to use TimeoutContext abstraction ( #4131 ) )
62
66
if ( ! ( operation instanceof AbstractOperation ) ) {
63
67
// TODO(NODE-3483): Extend MongoRuntimeError
64
68
throw new MongoRuntimeError ( 'This method requires a valid operation instance' ) ;
@@ -82,6 +86,12 @@ export async function executeOperation<
82
86
throw new MongoInvalidArgumentError ( 'ClientSession must be from the same MongoClient' ) ;
83
87
}
84
88
89
+ timeoutContext ??= TimeoutContext . create ( {
90
+ serverSelectionTimeoutMS : client . s . options . serverSelectionTimeoutMS ,
91
+ waitQueueTimeoutMS : client . s . options . waitQueueTimeoutMS ,
92
+ timeoutMS : operation . options . timeoutMS
93
+ } ) ;
94
+
85
95
const readPreference = operation . readPreference ?? ReadPreference . primary ;
86
96
const inTransaction = ! ! session ?. inTransaction ( ) ;
87
97
@@ -113,7 +123,8 @@ export async function executeOperation<
113
123
topology,
114
124
timeoutContext,
115
125
session,
116
- readPreference
126
+ readPreference,
127
+ timeoutContext
117
128
} ) ;
118
129
} finally {
119
130
if ( session ?. owner != null && session . owner === owner ) {
0 commit comments