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

Commit 8625ad8

Browse files
authored
Explicit cast to enforce type hints. (#13939)
1 parent e5fdf16 commit 8625ad8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

changelog.d/13939.feature

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Experimental support for thread-specific receipts ([MSC3771](https://github.com/matrix-org/matrix-spec-proposals/pull/3771)).

synapse/storage/databases/main/event_push_actions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ def _handle_new_receipts_for_notifs_txn(self, txn: LoggingTransaction) -> bool:
10681068
limit,
10691069
),
10701070
)
1071-
rows = txn.fetchall()
1071+
rows = cast(List[Tuple[int, str, str, int]], txn.fetchall())
10721072

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

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

11231123
self.db_pool.simple_update_txn(
11241124
txn,
11251125
table="event_push_summary_last_receipt_stream_id",
11261126
keyvalues={},
1127-
updatevalues={"stream_id": upper_limit},
1127+
updatevalues={"stream_id": receipts_last_processed_stream_id},
11281128
)
11291129

11301130
return len(rows) < limit

0 commit comments

Comments
 (0)