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

Commit

Permalink
Change THROTTLE_START_MS to just be the delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Velten committed Dec 7, 2023
1 parent 651b2ab commit 7701536
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions synapse/push/emailpusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
# THROTTLE is the minimum time between mail notifications sent for a given room.
# Each room maintains its own throttle counter, but each new mail notification
# sends the pending notifications for all rooms.
THROTTLE_START_MS = 10 * 60 * 1000
THROTTLE_MAX_MS = 24 * 60 * 60 * 1000 # 24h
# THROTTLE_MULTIPLIER = 6 # 10 mins, 1 hour, 6 hours, 24 hours
THROTTLE_MULTIPLIER = 144 # 10 mins, 24 hours - i.e. jump straight to 1 day
Expand Down Expand Up @@ -298,10 +297,10 @@ async def sent_notif_update_throttle(
current_throttle_ms = self.get_room_throttle_ms(room_id)

if gap > THROTTLE_RESET_AFTER_MS:
new_throttle_ms = THROTTLE_START_MS
new_throttle_ms = self._delay_before_mail_ms
else:
if current_throttle_ms == 0:
new_throttle_ms = THROTTLE_START_MS
new_throttle_ms = self._delay_before_mail_ms
else:
new_throttle_ms = min(
current_throttle_ms * THROTTLE_MULTIPLIER, THROTTLE_MAX_MS
Expand Down

0 comments on commit 7701536

Please sign in to comment.