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

Commit

Permalink
Fix "'int' object is not iterable" error in set_device_id_for_pushers…
Browse files Browse the repository at this point in the history
… background update (#16594)

A regression from removing the cursor_to_dict call, adds back
the wrapping into a tuple.
  • Loading branch information
clokep authored Nov 2, 2023
1 parent c5b5439 commit bf69b57
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/16594.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix "'int' object is not iterable" error in `set_device_id_for_pushers` background update introduced in Synapse 1.95.0.
4 changes: 2 additions & 2 deletions synapse/storage/databases/main/pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def set_device_id_for_pushers_txn(txn: LoggingTransaction) -> int:
(last_pusher_id, batch_size),
)

rows = txn.fetchall()
rows = cast(List[Tuple[int, Optional[str], Optional[str]]], txn.fetchall())
if len(rows) == 0:
return 0

Expand All @@ -617,7 +617,7 @@ def set_device_id_for_pushers_txn(txn: LoggingTransaction) -> int:
txn=txn,
table="pushers",
key_names=("id",),
key_values=[row[0] for row in rows],
key_values=[(row[0],) for row in rows],
value_names=("device_id", "access_token"),
# If there was already a device_id on the pusher, we only want to clear
# the access_token column, so we keep the existing device_id. Otherwise,
Expand Down

0 comments on commit bf69b57

Please sign in to comment.