diff --git a/synapse/storage/databases/main/delayed_events.py b/synapse/storage/databases/main/delayed_events.py index 8b631463c8d..ef4921d77ab 100644 --- a/synapse/storage/databases/main/delayed_events.py +++ b/synapse/storage/databases/main/delayed_events.py @@ -53,7 +53,7 @@ Delay = NewType("Delay", int) Timestamp = NewType("Timestamp", int) -DelayedEventDetails = Tuple[ +DelayedPartialEvent = Tuple[ RoomID, EventType, Optional[StateKey], @@ -295,7 +295,7 @@ async def get_all_for_user( ] async def process_all_delays(self, current_ts: Timestamp) -> Tuple[ - List[DelayedEventDetails], + List[DelayedPartialEvent], List[Tuple[DelayID, UserLocalpart, Delay]], ]: """ @@ -305,10 +305,10 @@ async def process_all_delays(self, current_ts: Timestamp) -> Tuple[ """ def process_all_delays_txn(txn: LoggingTransaction) -> Tuple[ - List[DelayedEventDetails], + List[DelayedPartialEvent], List[Tuple[DelayID, UserLocalpart, Delay]], ]: - events: List[DelayedEventDetails] = [] + events: List[DelayedPartialEvent] = [] removed_timeout_delay_ids: Set[DelayID] = set() txn.execute( @@ -359,7 +359,7 @@ async def pop_event( delay_id: DelayID, user_localpart: UserLocalpart, ) -> Tuple[ - DelayedEventDetails, + DelayedPartialEvent, Set[DelayID], ]: """ @@ -388,7 +388,7 @@ def _pop_event_txn( txn: LoggingTransaction, keyvalues: Dict[str, Any], ) -> Tuple[ - DelayedEventDetails, + DelayedPartialEvent, Set[DelayID], ]: row = self.db_pool.simple_select_one_txn( @@ -422,7 +422,6 @@ def _pop_event_txn( txn, keyvalues={"delay_rowid": parent_rowid or target_delay_rowid}, retcols=("delay_id",), - allow_none=False, ) contents: JsonDict = db_to_json(event_row[4]) @@ -461,7 +460,6 @@ async def remove( "user_localpart": user_localpart, }, retcols=("delay_id",), - allow_none=False, ) return {DelayID(r[0]) for r in removed_timeout_delay_ids} @@ -494,7 +492,7 @@ def _remove_txn( txn: LoggingTransaction, keyvalues: Dict[str, Any], retcols: StrCollection, - allow_none: bool, + allow_none: bool = False, ) -> List[Tuple]: """ Removes delayed events matching the keyvalues, and any children they may have. @@ -503,7 +501,7 @@ def _remove_txn( The specified columns for each delayed event with a timeout that was removed. Raises: - NotFoundError if allow_none is True and no delayed events match the keyvalues. + NotFoundError if allow_none is False and no delayed events match the keyvalues. """ sql_with = f""" WITH target_rowids AS (