MCPcopy
hub / github.com/mongodb/node-mongodb-native / shouldUnpinAfterCommitError

Function shouldUnpinAfterCommitError

src/sessions.ts:943–959  ·  view source on GitHub ↗
(commitError: Error)

Source from the content-addressed store, hash-verified

941]);
942
943function shouldUnpinAfterCommitError(commitError: Error) {
944 if (commitError instanceof MongoError) {
945 if (
946 isRetryableWriteError(commitError) ||
947 commitError instanceof MongoWriteConcernError ||
948 isMaxTimeMSExpiredError(commitError)
949 ) {
950 if (isUnknownTransactionCommitResult(commitError)) {
951 // per txns spec, must unpin session in this case
952 return true;
953 }
954 } else if (commitError.hasErrorLabel(MongoErrorLabel.TransientTransactionError)) {
955 return true;
956 }
957 }
958 return false;
959}
960
961function shouldAddUnknownTransactionCommitResultLabel(commitError: MongoError) {
962 let ok = isRetryableWriteError(commitError);

Callers 1

commitTransactionMethod · 0.85

Calls 4

isRetryableWriteErrorFunction · 0.90
isMaxTimeMSExpiredErrorFunction · 0.85
hasErrorLabelMethod · 0.45

Tested by

no test coverage detected