Skip to content

Commit

Permalink
fix: increase transaction retry count&timeout (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus authored Apr 6, 2023
1 parent 3bbf543 commit 2516221
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/supertokens/storage/postgresql/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ public <T> T startTransaction(TransactionLogic<T> logic, TransactionIsolationLev
// we have deadlock as well due to the DeadlockTest.java
exceptionMessage.toLowerCase().contains("deadlock");

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

0 comments on commit 2516221

Please sign in to comment.