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

Fix "'int' object is not iterable" error in set_device_id_for_pushers background update #16594

Merged
merged 2 commits into from
Nov 2, 2023
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/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],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, is this from the cursor_to_dict changes?

I guess this means we don't have any test coverage for this background update? :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From #16431, yes. Probably not... we should probably fail unit tests if any errors happen in the background, but there's no guarantee this actually runs with any data?

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
Loading