Fix TypeError in synapse.notifier (#7880)

Fixes #7774
This commit is contained in:
Erik Johnston 2020-07-17 14:11:05 +01:00 committed by GitHub
parent 852930add7
commit a3ad045286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

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

@ -0,0 +1 @@
Fix "TypeError in `synapse.notifier`" exceptions.

View File

@ -421,6 +421,10 @@ class DeviceHandler(DeviceWorkerHandler):
"""Notify that a user's device(s) has changed. Pokes the notifier, and """Notify that a user's device(s) has changed. Pokes the notifier, and
remote servers if the user is local. remote servers if the user is local.
""" """
if not device_ids:
# No changes to notify about, so this is a no-op.
return
users_who_share_room = await self.store.get_users_who_share_room_with_user( users_who_share_room = await self.store.get_users_who_share_room_with_user(
user_id user_id
) )
@ -436,6 +440,10 @@ class DeviceHandler(DeviceWorkerHandler):
user_id, device_ids, list(hosts) user_id, device_ids, list(hosts)
) )
if not position:
# This should only happen if there are no updates, so we bail.
return
for device_id in device_ids: for device_id in device_ids:
logger.debug( logger.debug(
"Notifying about update %r/%r, ID: %r", user_id, device_id, position "Notifying about update %r/%r, ID: %r", user_id, device_id, position