From 2a78554196c64a1a2938d97a09b8b745676a15a4 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 26 Oct 2021 14:44:14 +0100 Subject: Remove _notify_app_services_ephemeral; convert token in on_new_event instead This is a small effort to reduce the layers of methods we have here. Also, I've opted to continue converting the RoomStreamToken to an int, but only for when tracking stream tokens of EDUs. As stated in the comment, this shouldn't have any gaps as long as we *always* convert to minimum value. --- synapse/handlers/appservice.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index 6cad82f542..313d539e45 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -182,7 +182,7 @@ class ApplicationServicesHandler: def notify_interested_services_ephemeral( self, stream_key: str, - new_token: int, + new_token: Union[int, RoomStreamToken], users: Optional[Collection[Union[str, UserID]]] = None, ) -> None: """ @@ -212,6 +212,13 @@ class ApplicationServicesHandler: if stream_key not in ("typing_key", "receipt_key", "presence_key"): return + # Convert new_token from a RoomStreamToken to an int if necessary. + # We just use the minimum stream ordering and ignore the vector clock + # component. This is safe to do as long as we *always* ignore the vector + # clock components. + if isinstance(new_token, RoomStreamToken): + new_token = new_token.stream + services = [ service for service in self.store.get_app_services() -- cgit 1.4.1