Explicit cast to enforce type hints. (#13939)

This commit is contained in:
Patrick Cloke 2022-09-29 07:22:41 -04:00 committed by GitHub
parent e5fdf16d46
commit 8625ad8099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

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

View File

@ -1068,7 +1068,7 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
limit, 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 # For each new read receipt we delete push actions from before it and
# recalculate the summary. # recalculate the summary.
@ -1113,18 +1113,18 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
# We always update `event_push_summary_last_receipt_stream_id` to # We always update `event_push_summary_last_receipt_stream_id` to
# ensure that we don't rescan the same receipts for remote users. # 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 len(rows) >= limit:
# If we pulled out a limited number of rows we only update the # If we pulled out a limited number of rows we only update the
# position to the last receipt we processed, so we continue # position to the last receipt we processed, so we continue
# processing the rest next iteration. # processing the rest next iteration.
upper_limit = rows[-1][0] receipts_last_processed_stream_id = rows[-1][0]
self.db_pool.simple_update_txn( self.db_pool.simple_update_txn(
txn, txn,
table="event_push_summary_last_receipt_stream_id", table="event_push_summary_last_receipt_stream_id",
keyvalues={}, keyvalues={},
updatevalues={"stream_id": upper_limit}, updatevalues={"stream_id": receipts_last_processed_stream_id},
) )
return len(rows) < limit return len(rows) < limit