Skip to content

Commit

Permalink
Do not wait on the first DB serialization failure
Browse files Browse the repository at this point in the history
  • Loading branch information
epandurski committed Jul 29, 2019
1 parent 0b40bbe commit 6300de5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flask_signalbus/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ def f(*args, **kwargs):
if num_failures > retries or not is_serialization_error:
raise
session.rollback()
wait_seconds = min(max_wait, min_wait * 2 ** (num_failures - 1))
time.sleep(wait_seconds)
if num_failures > 1:
wait_seconds = min(max_wait, min_wait * 2 ** (num_failures - 2))
time.sleep(wait_seconds)

return f

Expand Down

0 comments on commit 6300de5

Please sign in to comment.