You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/sessions.ts
+28-2Lines changed: 28 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -726,7 +726,8 @@ export class ClientSession
726
726
})
727
727
: null;
728
728
729
-
conststartTime=this.timeoutContext?.csotEnabled()
729
+
// 1. Record the current monotonic time, which will be used to enforce the 120-second timeout before later retry attempts.
730
+
conststartTime=this.timeoutContext?.csotEnabled()// This is strictly to appease TS. We must narrow the context to a CSOT context before accessing `.start`.
730
731
? this.timeoutContext.start
731
732
: processTimeMS();
732
733
@@ -735,9 +736,13 @@ export class ClientSession
735
736
736
737
try{
737
738
while(!committed){
739
+
// 2. Invoke startTransaction on the session
740
+
// 3. If `startTransaction` reported an error, propagate that error to the caller of `withTransaction` and return immediately.
738
741
this.startTransaction(options);// may throw on error
739
742
740
743
try{
744
+
// 4. Invoke the callback.
745
+
// 5. Control returns to withTransaction. (continued below)
741
746
constpromise=fn(this);
742
747
if(!isPromiseLike(promise)){
743
748
thrownewMongoInvalidArgumentError(
@@ -747,16 +752,22 @@ export class ClientSession
747
752
748
753
result=awaitpromise;
749
754
755
+
// 5. (cont.) Determine the current state of the ClientSession (continued below)
0 commit comments