From c59d7173c7af8995f0f918f24fb35dbe9db637af Mon Sep 17 00:00:00 2001 From: Nick Barrett Date: Thu, 14 Jul 2022 16:58:46 +0200 Subject: [PATCH] Fixup docstrings & txn names --- synapse/storage/databases/main/appservice.py | 12 ++++++++++-- synapse/storage/databases/main/stream.py | 10 ++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/synapse/storage/databases/main/appservice.py b/synapse/storage/databases/main/appservice.py index 3ef6b5f3581d..64b70a7b28ee 100644 --- a/synapse/storage/databases/main/appservice.py +++ b/synapse/storage/databases/main/appservice.py @@ -372,19 +372,27 @@ def _get_oldest_unsent_txn( ) async def get_appservice_last_pos(self) -> int: + """ + Get the last stream ordering position for the appservice process. + """ + return await self.db_pool.simple_select_one_onecol( table="appservice_stream_position", retcol="stream_ordering", keyvalues={}, - desc="get_appservice_last_pos_txn", + desc="get_appservice_last_pos", ) async def set_appservice_last_pos(self, pos: int) -> None: + """ + Set the last stream ordering position for the appservice process. + """ + await self.db_pool.simple_update_one( table="appservice_stream_position", keyvalues={}, updatevalues={"stream_ordering": pos}, - desc="set_appservice_last_pos_txn", + desc="set_appservice_last_pos", ) async def get_type_stream_id_for_appservice( diff --git a/synapse/storage/databases/main/stream.py b/synapse/storage/databases/main/stream.py index d145061213b8..2590b52f7352 100644 --- a/synapse/storage/databases/main/stream.py +++ b/synapse/storage/databases/main/stream.py @@ -1032,12 +1032,14 @@ async def get_all_new_events_stream( from_id: the stream_ordering of the last event we processed current_id: the stream_ordering of the most recently processed event limit: the maximum number of events to return + get_prev_content: whether to fetch previous event content Returns: - A tuple of (next_id, events), where `next_id` is the next value to - pass as `from_id` (it will either be the stream_ordering of the - last returned event, or, if fewer than `limit` events were found, - the `current_id`). + A tuple of (next_id, events, event_to_received_ts), where `next_id` + is the next value to pass as `from_id` (it will either be the + stream_ordering of the last returned event, or, if fewer than `limit` + events were found, the `current_id`). The `event_to_received_ts` is + a dictionary mapping event ID to the event `received_ts`. """ def get_all_new_events_stream_txn(