From 5153b9a81d1a1fcb88bfb4ac3a0b25e9e078fccc Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Tue, 24 Oct 2023 13:14:34 -0400 Subject: [PATCH] Proper return type for pusher_throttle. --- synapse/storage/databases/main/pusher.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/synapse/storage/databases/main/pusher.py b/synapse/storage/databases/main/pusher.py index 0be1f2e50bd6..a6a1671bd649 100644 --- a/synapse/storage/databases/main/pusher.py +++ b/synapse/storage/databases/main/pusher.py @@ -372,7 +372,7 @@ async def get_throttle_params_by_room( self, pusher_id: int ) -> Dict[str, ThrottleParams]: res = cast( - List[Tuple[str, int, int]], + List[Tuple[str, Optional[int], Optional[int]]], await self.db_pool.simple_select_list( "pusher_throttle", {"pusher": pusher_id}, @@ -383,7 +383,9 @@ async def get_throttle_params_by_room( params_by_room = {} for room_id, last_sent_ts, throttle_ms in res: - params_by_room[room_id] = ThrottleParams(last_sent_ts, throttle_ms) + params_by_room[room_id] = ThrottleParams( + last_sent_ts or 0, throttle_ms or 0 + ) return params_by_room