Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #393 from matrix-org/erikj/destination_retry_max
Browse files Browse the repository at this point in the history
Use min and not max to set an upper bound on retry interval
  • Loading branch information
erikjohnston committed Nov 20, 2015
2 parents 8b5349c + 2f2bbb4 commit 9de1f32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions synapse/http/matrixfederationclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ def send_request():
if retries_left and not timeout:
if long_retries:
delay = 4 ** (MAX_LONG_RETRIES + 1 - retries_left)
delay = max(delay, 60)
delay = min(delay, 60)
delay *= random.uniform(0.8, 1.4)
else:
delay = 0.5 * 2 ** (MAX_SHORT_RETRIES - retries_left)
delay = max(delay, 2)
delay = min(delay, 2)
delay *= random.uniform(0.8, 1.4)

yield sleep(delay)
Expand Down

0 comments on commit 9de1f32

Please sign in to comment.