summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-07-17 14:11:05 +0100
committerGitHub <noreply@github.com>2020-07-17 14:11:05 +0100
commita3ad04528606db44c23200811ae68618ad17cd80 (patch)
treee06c1fa595d72a3e2480b94e1ad9a0338441ade1
parentAdd a default limit (of 100) to get/sync operations. (#7858) (diff)
downloadsynapse-a3ad04528606db44c23200811ae68618ad17cd80.tar.xz
Fix TypeError in synapse.notifier (#7880)
Fixes #7774
Diffstat (limited to '')
-rw-r--r--changelog.d/7880.bugfix1
-rw-r--r--synapse/handlers/device.py8
2 files changed, 9 insertions, 0 deletions
diff --git a/changelog.d/7880.bugfix b/changelog.d/7880.bugfix
new file mode 100644
index 0000000000..356add0996
--- /dev/null
+++ b/changelog.d/7880.bugfix
@@ -0,0 +1 @@
+Fix "TypeError in `synapse.notifier`" exceptions.
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py
index f947aa1627..db417d60de 100644
--- a/synapse/handlers/device.py
+++ b/synapse/handlers/device.py
@@ -421,6 +421,10 @@ class DeviceHandler(DeviceWorkerHandler):
         """Notify that a user's device(s) has changed. Pokes the notifier, and
         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(
             user_id
         )
@@ -436,6 +440,10 @@ class DeviceHandler(DeviceWorkerHandler):
             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:
             logger.debug(
                 "Notifying about update %r/%r, ID: %r", user_id, device_id, position