summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-07-30 12:46:21 +0100
committerErik Johnston <erik@matrix.org>2024-07-30 12:46:21 +0100
commit11f34920e73f3cd2365cc6ca3c4fffe9de37b9a6 (patch)
tree3d63ca152b43b6d114a609ceee7901e07f36d774
parentBump ruff from 0.5.4 to 0.5.5 (#17494) (diff)
downloadsynapse-11f34920e73f3cd2365cc6ca3c4fffe9de37b9a6.tar.xz
Refactor to make LIVE non-static value
-rw-r--r--synapse/handlers/sliding_sync.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py
index 73414dbf69..6ddc8ff87b 100644
--- a/synapse/handlers/sliding_sync.py
+++ b/synapse/handlers/sliding_sync.py
@@ -2238,13 +2238,16 @@ class HaveSentRoom:
     last_token: Optional[RoomStreamToken]
 
     @staticmethod
+    def live() -> "HaveSentRoom":
+        return HaveSentRoom(HaveSentRoomFlag.LIVE, None)
+
+    @staticmethod
     def previously(last_token: RoomStreamToken) -> "HaveSentRoom":
         """Constructor for `PREVIOUSLY` flag."""
         return HaveSentRoom(HaveSentRoomFlag.PREVIOUSLY, last_token)
 
 
 HAVE_SENT_ROOM_NEVER = HaveSentRoom(HaveSentRoomFlag.NEVER, None)
-HAVE_SENT_ROOM_LIVE = HaveSentRoom(HaveSentRoomFlag.LIVE, None)
 
 
 @attr.s(auto_attribs=True)
@@ -2339,7 +2342,7 @@ class SlidingSyncConnectionStore:
         # end we can treat this as a noop.
         have_updated = False
         for room_id in sent_room_ids:
-            new_room_statuses[room_id] = HAVE_SENT_ROOM_LIVE
+            new_room_statuses[room_id] = HaveSentRoom.live()
             have_updated = True
 
         # Whether we add/update the entries for unsent rooms depends on the