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

Explicit cast to enforce type hints. #13939

Merged
merged 2 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13939.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Experimental support for thread-specific receipts ([MSC3771](https://github.com/matrix-org/matrix-spec-proposals/pull/3771)).
8 changes: 4 additions & 4 deletions synapse/storage/databases/main/event_push_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ def _handle_new_receipts_for_notifs_txn(self, txn: LoggingTransaction) -> bool:
limit,
),
)
rows = txn.fetchall()
rows = cast(List[Tuple[int, str, str, int]], txn.fetchall())

# For each new read receipt we delete push actions from before it and
# recalculate the summary.
Expand Down Expand Up @@ -1119,18 +1119,18 @@ def _handle_new_receipts_for_notifs_txn(self, txn: LoggingTransaction) -> bool:
# We always update `event_push_summary_last_receipt_stream_id` to
# ensure that we don't rescan the same receipts for remote users.

upper_limit = max_receipts_stream_id
receipts_last_processed_stream_id = max_receipts_stream_id
if len(rows) >= limit:
# If we pulled out a limited number of rows we only update the
# position to the last receipt we processed, so we continue
# processing the rest next iteration.
upper_limit = rows[-1][0]
receipts_last_processed_stream_id = rows[-1][0]

self.db_pool.simple_update_txn(
txn,
table="event_push_summary_last_receipt_stream_id",
keyvalues={},
updatevalues={"stream_id": upper_limit},
updatevalues={"stream_id": receipts_last_processed_stream_id},
)

return len(rows) < limit
Expand Down