mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-09-29 01:29:29 -04:00
Make token serializing/deserializing async (#8427)
The idea is that in future tokens will encode a mapping of instance to position. However, we don't want to include the full instance name in the string representation, so instead we'll have a mapping between instance name and an immutable integer ID in the DB that we can use instead. We'll then do the lookup when we serialize/deserialize the token (we could alternatively pass around an `Instance` type that includes both the name and ID, but that turns out to be a lot more invasive).
This commit is contained in:
parent
a0a1ba6973
commit
7941372ec8
17 changed files with 115 additions and 59 deletions
|
@ -180,6 +180,7 @@ class KeyChangesServlet(RestServlet):
|
|||
super().__init__()
|
||||
self.auth = hs.get_auth()
|
||||
self.device_handler = hs.get_device_handler()
|
||||
self.store = hs.get_datastore()
|
||||
|
||||
async def on_GET(self, request):
|
||||
requester = await self.auth.get_user_by_req(request, allow_guest=True)
|
||||
|
@ -191,7 +192,7 @@ class KeyChangesServlet(RestServlet):
|
|||
# changes after the "to" as well as before.
|
||||
set_tag("to", parse_string(request, "to"))
|
||||
|
||||
from_token = StreamToken.from_string(from_token_string)
|
||||
from_token = await StreamToken.from_string(self.store, from_token_string)
|
||||
|
||||
user_id = requester.user.to_string()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue