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

A regression from removing the cursor_to_dict call, adds back
the wrapping into a tuple.
pull/16653/head
Patrick Cloke 2023-11-02 10:00:18 -04:00 committed by GitHub
parent c5b543938b
commit bf69b57422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

1
changelog.d/16594.bugfix Normal file
View File

@ -0,0 +1 @@
Fix "'int' object is not iterable" error in `set_device_id_for_pushers` background update introduced in Synapse 1.95.0.

View File

@ -601,7 +601,7 @@ class PusherBackgroundUpdatesStore(SQLBaseStore):
(last_pusher_id, batch_size), (last_pusher_id, batch_size),
) )
rows = txn.fetchall() rows = cast(List[Tuple[int, Optional[str], Optional[str]]], txn.fetchall())
if len(rows) == 0: if len(rows) == 0:
return 0 return 0
@ -617,7 +617,7 @@ class PusherBackgroundUpdatesStore(SQLBaseStore):
txn=txn, txn=txn,
table="pushers", table="pushers",
key_names=("id",), 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"), value_names=("device_id", "access_token"),
# If there was already a device_id on the pusher, we only want to clear # 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, # the access_token column, so we keep the existing device_id. Otherwise,