summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2021-11-19 15:21:49 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2021-11-19 18:15:10 +0000
commitce020c30fc16418a56a0b7e34e17660f923374ef (patch)
tree145c68d7210b6a411b8c492ac6bbe020a9d5f168
parentMake msc2409_to_device_messages_enabled private; remove unnecessary check (diff)
downloadsynapse-ce020c30fc16418a56a0b7e34e17660f923374ef.tar.xz
Move stream filter back into AppserviceHandler
-rw-r--r--synapse/handlers/appservice.py10
-rw-r--r--synapse/notifier.py28
2 files changed, 21 insertions, 17 deletions
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py
index 8d5658f114..fb9ad3ba62 100644
--- a/synapse/handlers/appservice.py
+++ b/synapse/handlers/appservice.py
@@ -220,6 +220,16 @@ class ApplicationServicesHandler:
         if not self.notify_appservices:
             return
 
+        # Notify appservices of updates in ephemeral event streams.
+        # Only the following streams are currently supported.
+        if stream_key not in (
+            "typing_key",
+            "receipt_key",
+            "presence_key",
+            "to_device_key",
+        ):
+            return
+
         # Assert that new_token is an integer (and not a RoomStreamToken).
         # All of the supported streams that this function handles use an
         # integer to track progress (rather than a RoomStreamToken - a
diff --git a/synapse/notifier.py b/synapse/notifier.py
index eb316ae419..3b24a7f4ba 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -444,23 +444,17 @@ class Notifier:
 
             self.notify_replication()
 
-            # Notify appservices of updates in ephemeral event streams.
-            # Only the following streams are currently supported.
-            if stream_key in (
-                "typing_key",
-                "receipt_key",
-                "presence_key",
-                "to_device_key",
-            ):
-                # Notify appservices.
-                try:
-                    self.appservice_handler.notify_interested_services_ephemeral(
-                        stream_key,
-                        new_token,
-                        users,
-                    )
-                except Exception:
-                    logger.exception("Error notifying application services of event")
+            # Notify appservices.
+            try:
+                self.appservice_handler.notify_interested_services_ephemeral(
+                    stream_key,
+                    new_token,
+                    users,
+                )
+            except Exception:
+                logger.exception(
+                    "Error notifying application services of ephemeral event"
+                )
 
     def on_new_replication_data(self) -> None:
         """Used to inform replication listeners that something has happened