diff options
author | Erik Johnston <erik@matrix.org> | 2022-02-22 14:36:44 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2022-02-22 14:36:44 +0000 |
commit | 3d92936c1478107582bd2f3b47df971cab5214f6 (patch) | |
tree | e8c8badf660253af141c351a68a446a630952e54 /synapse/push/httppusher.py | |
parent | Merge branch 'release-v1.53' into matrix-org-hotfixes (diff) | |
parent | Cap the number of in-flight requests for state from a single group (#11608) (diff) | |
download | synapse-3d92936c1478107582bd2f3b47df971cab5214f6.tar.xz |
Merge remote-tracking branch 'origin/develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/push/httppusher.py')
-rw-r--r-- | synapse/push/httppusher.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/push/httppusher.py b/synapse/push/httppusher.py index fece3796cc..bf40f596f6 100644 --- a/synapse/push/httppusher.py +++ b/synapse/push/httppusher.py @@ -114,6 +114,7 @@ class HttpPusher(Pusher): self.data_minus_url = {} self.data_minus_url.update(self.data) del self.data_minus_url["url"] + self.badge_count_last_call: Optional[int] = None def on_started(self, should_check_for_notifs: bool) -> None: """Called when this pusher has been started. @@ -141,7 +142,9 @@ class HttpPusher(Pusher): self.user_id, group_by_room=self._group_unread_count_by_room, ) - await self._send_badge(badge) + if self.badge_count_last_call is None or self.badge_count_last_call != badge: + self.badge_count_last_call = badge + await self._send_badge(badge) def on_timer(self) -> None: self._start_processing() @@ -327,7 +330,7 @@ class HttpPusher(Pusher): # This was checked in the __init__, but mypy doesn't seem to know that. assert self.data is not None if self.data.get("format") == "event_id_only": - d = { + d: Dict[str, Any] = { "notification": { "event_id": event.event_id, "room_id": event.room_id, @@ -407,6 +410,8 @@ class HttpPusher(Pusher): rejected = [] if "rejected" in resp: rejected = resp["rejected"] + else: + self.badge_count_last_call = badge return rejected async def _send_badge(self, badge: int) -> None: |