Skip to content

Commit 6a0af2b

Browse files
committed
unpin the session when a SystemOverloadedError occurs
1 parent e798fd8 commit 6a0af2b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/operations/execute_operation.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,15 @@ async function executeOperationWithRetries<
349349
session.unpin({ force: true, forceClear: true });
350350
}
351351

352+
if (
353+
operationError.hasErrorLabel(MongoErrorLabel.SystemOverloadedError) &&
354+
session != null &&
355+
session.isPinned &&
356+
!session.inTransaction()
357+
) {
358+
session.unpin({ force: true });
359+
}
360+
352361
if (
353362
topology.description.type === TopologyType.Sharded ||
354363
operationError.hasErrorLabel(MongoErrorLabel.SystemOverloadedError)

0 commit comments

Comments
 (0)