diff options
author | Will Hunt <will@half-shot.uk> | 2020-10-15 17:33:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-15 12:33:28 -0400 |
commit | c276bd996916adce899410b9c4c891892f51b992 (patch) | |
tree | 4e6e2737c82d963e8f00945f4e1b0fafcf835423 /synapse/notifier.py | |
parent | Add option to scripts-dev/lint.sh to only lint files changed since the last g... (diff) | |
download | synapse-c276bd996916adce899410b9c4c891892f51b992.tar.xz |
Send some ephemeral events to appservices (#8437)
Optionally sends typing, presence, and read receipt information to appservices.
Diffstat (limited to 'synapse/notifier.py')
-rw-r--r-- | synapse/notifier.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py index 51c830c91e..2e993411b9 100644 --- a/synapse/notifier.py +++ b/synapse/notifier.py @@ -329,6 +329,22 @@ class Notifier: except Exception: logger.exception("Error notifying application services of event") + async def _notify_app_services_ephemeral( + self, + stream_key: str, + new_token: Union[int, RoomStreamToken], + users: Collection[UserID] = [], + ): + try: + stream_token = None + if isinstance(new_token, int): + stream_token = new_token + await self.appservice_handler.notify_interested_services_ephemeral( + stream_key, stream_token, users + ) + except Exception: + logger.exception("Error notifying application services of event") + async def _notify_pusher_pool(self, max_room_stream_token: RoomStreamToken): try: await self._pusher_pool.on_new_notifications(max_room_stream_token) @@ -367,6 +383,15 @@ class Notifier: self.notify_replication() + # Notify appservices + run_as_background_process( + "_notify_app_services_ephemeral", + self._notify_app_services_ephemeral, + stream_key, + new_token, + users, + ) + def on_new_replication_data(self) -> None: """Used to inform replication listeners that something has happend without waking up any of the normal user event streams""" |