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 faaa6d708d..4dac745015 100644 --- a/synapse/notifier.py +++ b/synapse/notifier.py @@ -454,23 +454,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