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

Commit

Permalink
Fix bug in calculating the federation retry backoff period (#6025)
Browse files Browse the repository at this point in the history
This was intended to introduce an element of jitter; instead it gave you a
30/60 chance of resetting to zero.
  • Loading branch information
richvdh committed Sep 12, 2019
1 parent 59975f9 commit 0388bea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/6025.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug in calculating the federation retry backoff period.
5 changes: 3 additions & 2 deletions synapse/util/retryutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ def __exit__(self, exc_type, exc_val, exc_tb):
else:
# We couldn't connect.
if self.retry_interval:
self.retry_interval *= RETRY_MULTIPLIER
self.retry_interval *= int(random.uniform(0.8, 1.4))
self.retry_interval = int(
self.retry_interval * RETRY_MULTIPLIER * random.uniform(0.8, 1.4)
)

if self.retry_interval >= MAX_RETRY_INTERVAL:
self.retry_interval = MAX_RETRY_INTERVAL
Expand Down

0 comments on commit 0388bea

Please sign in to comment.