Skip to content

Commit 62019f6

Browse files
committed
fix: condition (hasWriteAspect && willRetryWrite)
1 parent 0148f5e commit 62019f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/operations/execute_operation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,17 @@ async function executeOperationAsync<
192192

193193
const hasReadAspect = operation.hasAspect(Aspect.READ_OPERATION);
194194
const hasWriteAspect = operation.hasAspect(Aspect.WRITE_OPERATION);
195-
const retryable = (hasReadAspect && willRetryRead) || (hasWriteAspect && willRetryWrite);
195+
const willRetry = (hasReadAspect && willRetryRead) || (hasWriteAspect && willRetryWrite);
196196

197-
if (retryable) {
197+
if (hasWriteAspect && willRetryWrite) {
198198
operation.options.willRetryWrite = true;
199199
session.incrementTransactionNumber();
200200
}
201201

202202
try {
203203
return await operation.executeAsync(server, session);
204204
} catch (operationError) {
205-
if (retryable && operationError instanceof MongoError) {
205+
if (willRetry && operationError instanceof MongoError) {
206206
return await retryOperation(operation, operationError, {
207207
session,
208208
topology,

0 commit comments

Comments
 (0)