mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-17 07:21:37 +01:00
Merge pull request #5531 from matrix-org/erikj/workers_pagination_token
Fix /messages on workers when no from param specified.
This commit is contained in:
commit
25433f212d
3 changed files with 20 additions and 17 deletions
1
changelog.d/5531.feature
Normal file
1
changelog.d/5531.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Add support for handling pagination APIs on client reader worker.
|
|
@ -180,9 +180,7 @@ class PaginationHandler(object):
|
||||||
room_token = pagin_config.from_token.room_key
|
room_token = pagin_config.from_token.room_key
|
||||||
else:
|
else:
|
||||||
pagin_config.from_token = (
|
pagin_config.from_token = (
|
||||||
yield self.hs.get_event_sources().get_current_token_for_room(
|
yield self.hs.get_event_sources().get_current_token_for_pagination()
|
||||||
room_id=room_id
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
room_token = pagin_config.from_token.room_key
|
room_token = pagin_config.from_token.room_key
|
||||||
|
|
||||||
|
|
|
@ -59,21 +59,25 @@ class EventSources(object):
|
||||||
defer.returnValue(token)
|
defer.returnValue(token)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_current_token_for_room(self, room_id):
|
def get_current_token_for_pagination(self):
|
||||||
push_rules_key, _ = self.store.get_push_rules_stream_token()
|
"""Get the current token for a given room to be used to paginate
|
||||||
to_device_key = self.store.get_to_device_stream_token()
|
events.
|
||||||
device_list_key = self.store.get_device_stream_token()
|
|
||||||
groups_key = self.store.get_group_stream_token()
|
|
||||||
|
|
||||||
|
The returned token does not have the current values for fields other
|
||||||
|
than `room`, since they are not used during pagination.
|
||||||
|
|
||||||
|
Retuns:
|
||||||
|
Deferred[StreamToken]
|
||||||
|
"""
|
||||||
token = StreamToken(
|
token = StreamToken(
|
||||||
room_key=(yield self.sources["room"].get_current_key_for_room(room_id)),
|
room_key=(yield self.sources["room"].get_current_key()),
|
||||||
presence_key=(yield self.sources["presence"].get_current_key()),
|
presence_key=0,
|
||||||
typing_key=(yield self.sources["typing"].get_current_key()),
|
typing_key=0,
|
||||||
receipt_key=(yield self.sources["receipt"].get_current_key()),
|
receipt_key=0,
|
||||||
account_data_key=(yield self.sources["account_data"].get_current_key()),
|
account_data_key=0,
|
||||||
push_rules_key=push_rules_key,
|
push_rules_key=0,
|
||||||
to_device_key=to_device_key,
|
to_device_key=0,
|
||||||
device_list_key=device_list_key,
|
device_list_key=0,
|
||||||
groups_key=groups_key,
|
groups_key=0,
|
||||||
)
|
)
|
||||||
defer.returnValue(token)
|
defer.returnValue(token)
|
||||||
|
|
Loading…
Reference in a new issue