Add StreamKeyType class and replace string literals with constants (#12567)

This commit is contained in:
Andrew Morgan 2022-05-16 16:35:31 +01:00 committed by GitHub
parent 3ce15cc7be
commit 83be72d76c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 125 additions and 80 deletions

View file

@ -46,6 +46,7 @@ from synapse.types import (
JsonDict,
PersistedEventPosition,
RoomStreamToken,
StreamKeyType,
StreamToken,
UserID,
)
@ -370,7 +371,7 @@ class Notifier:
if users or rooms:
self.on_new_event(
"room_key",
StreamKeyType.ROOM,
max_room_stream_token,
users=users,
rooms=rooms,
@ -440,7 +441,7 @@ class Notifier:
for room in rooms:
user_streams |= self.room_to_user_streams.get(room, set())
if stream_key == "to_device_key":
if stream_key == StreamKeyType.TO_DEVICE:
issue9533_logger.debug(
"to-device messages stream id %s, awaking streams for %s",
new_token,