Skip to content

Commit a8b0306

Browse files
author
Zhen Li
committed
More tests and fixed a bug in original code where the maxRetryTime is not used correctly.
1 parent fb45ba6 commit a8b0306

File tree

2 files changed

+297
-10
lines changed

2 files changed

+297
-10
lines changed

driver/src/main/java/org/neo4j/driver/internal/retry/ExponentialBackoffRetryLogic.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,11 @@ private Function<Flux<Throwable>,Publisher<Context>> retryRxCondition()
172172
startTime = currentTime;
173173
}
174174

175-
long delayWithJitterMs = computeDelayWithJitter( nextDelayMs );
176-
if ( delayWithJitterMs < maxRetryTimeMs )
175+
long elapsedTime = currentTime - startTime;
176+
if ( elapsedTime < maxRetryTimeMs )
177177
{
178-
log.warn( "Transaction failed and will be retried in " + delayWithJitterMs + "ms", lastError );
178+
long delayWithJitterMs = computeDelayWithJitter( nextDelayMs );
179+
log.warn( "Reactive transaction failed and is scheduled to retry in " + delayWithJitterMs + "ms", lastError );
179180

180181
nextDelayMs = (long) (nextDelayMs * multiplier);
181182
errors = recordError( lastError, errors );

0 commit comments

Comments
 (0)