summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2021-10-26 14:44:14 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2021-10-26 14:47:17 +0100
commit2a78554196c64a1a2938d97a09b8b745676a15a4 (patch)
tree5aa4b0c5fa2c8e1230502fb6c2516a5ec20534a8
parentwip - use int everywhere instead (diff)
downloadsynapse-github/anoa/e2e_as_room_stream_token_new.tar.xz
Remove _notify_app_services_ephemeral; convert token in on_new_event instead github/anoa/e2e_as_room_stream_token_new anoa/e2e_as_room_stream_token_new
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.
-rw-r--r--synapse/handlers/appservice.py9
1 files changed, 8 insertions, 1 deletions
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()