diff options
author | Erik Johnston <erikj@matrix.org> | 2023-10-04 18:28:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-04 16:28:40 +0100 |
commit | 80ec81dcc54bdb823b95c2f870a919868de9a481 (patch) | |
tree | 4890f3c4fc0b95fd8b91e2d1f7b30b8e228e7b36 /synapse/streams | |
parent | Update changelog (diff) | |
download | synapse-80ec81dcc54bdb823b95c2f870a919868de9a481.tar.xz |
Some refactors around receipts stream (#16426)
Diffstat (limited to 'synapse/streams')
-rw-r--r-- | synapse/streams/events.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/synapse/streams/events.py b/synapse/streams/events.py index d7084d2358..609a0978a9 100644 --- a/synapse/streams/events.py +++ b/synapse/streams/events.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import TYPE_CHECKING, Iterator, Tuple +from typing import TYPE_CHECKING, Sequence, Tuple import attr @@ -23,7 +23,7 @@ from synapse.handlers.room import RoomEventSource from synapse.handlers.typing import TypingNotificationEventSource from synapse.logging.opentracing import trace from synapse.streams import EventSource -from synapse.types import StreamToken +from synapse.types import StreamKeyType, StreamToken if TYPE_CHECKING: from synapse.server import HomeServer @@ -37,9 +37,14 @@ class _EventSourcesInner: receipt: ReceiptEventSource account_data: AccountDataEventSource - def get_sources(self) -> Iterator[Tuple[str, EventSource]]: - for attribute in attr.fields(_EventSourcesInner): - yield attribute.name, getattr(self, attribute.name) + def get_sources(self) -> Sequence[Tuple[StreamKeyType, EventSource]]: + return [ + (StreamKeyType.ROOM, self.room), + (StreamKeyType.PRESENCE, self.presence), + (StreamKeyType.TYPING, self.typing), + (StreamKeyType.RECEIPT, self.receipt), + (StreamKeyType.ACCOUNT_DATA, self.account_data), + ] class EventSources: |