Skip to content

Commit 2516221

Browse files
authored
fix: increase transaction retry count&timeout (#83)
1 parent 3bbf543 commit 2516221

File tree

1 file changed

+2
-2
lines changed
  • src/main/java/io/supertokens/storage/postgresql

1 file changed

+2
-2
lines changed

src/main/java/io/supertokens/storage/postgresql/Start.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ public <T> T startTransaction(TransactionLogic<T> logic, TransactionIsolationLev
231231
// we have deadlock as well due to the DeadlockTest.java
232232
exceptionMessage.toLowerCase().contains("deadlock");
233233

234-
if ((isPSQLRollbackException || isDeadlockException) && tries < 3) {
234+
if ((isPSQLRollbackException || isDeadlockException) && tries < 20) {
235235
try {
236-
Thread.sleep((long) (10 + (Math.random() * 20)));
236+
Thread.sleep((long) (10 + Math.min(tries, 10) * (Math.random() * 20)));
237237
} catch (InterruptedException ignored) {
238238
}
239239
ProcessState.getInstance(this).addState(ProcessState.PROCESS_STATE.DEADLOCK_FOUND, e);

0 commit comments

Comments
 (0)