Skip to content

Commit

Permalink
More fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFerr committed Jul 30, 2024
1 parent 281d625 commit 7959679
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions synapse/storage/databases/main/delayed_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
Delay = NewType("Delay", int)
Timestamp = NewType("Timestamp", int)

DelayedEventDetails = Tuple[
DelayedPartialEvent = Tuple[
RoomID,
EventType,
Optional[StateKey],
Expand Down Expand Up @@ -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]],
]:
"""
Expand All @@ -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(
Expand Down Expand Up @@ -359,7 +359,7 @@ async def pop_event(
delay_id: DelayID,
user_localpart: UserLocalpart,
) -> Tuple[
DelayedEventDetails,
DelayedPartialEvent,
Set[DelayID],
]:
"""
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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}

Expand Down Expand Up @@ -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.
Expand All @@ -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 (
Expand Down

0 comments on commit 7959679

Please sign in to comment.