Skip to content

Commit 49a85df

Browse files
authored
Merge pull request #1 from arpan14/retryerror
fix: prevent illegal negative timeout values into thread sleep() method while retrying exceptions in unit tests.
2 parents 510d0fb + edc5bbf commit 49a85df

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITClosedSessionTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ public void testTransactionManager() throws InterruptedException {
251251
break;
252252
}
253253
} catch (AbortedException e) {
254-
Thread.sleep(e.getRetryDelayInMillis());
254+
long retryDelayInMillis = e.getRetryDelayInMillis();
255+
if(retryDelayInMillis > 0) {
256+
Thread.sleep(retryDelayInMillis);
257+
}
255258
txn = manager.resetForRetry();
256259
}
257260
}

0 commit comments

Comments
 (0)