Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 908c279

Browse files
committed
MSC2918: temp: mark the access token as used only once
This is a temporary fix to work around the cache. It's only there to confirm it broke tests, and check if CI passes with this fix.
1 parent 6024ed8 commit 908c279

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

synapse/api/auth.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ async def get_user_by_req(
253253
if not user_info.token_used and token_id is not None:
254254
await self.store.mark_access_token_as_used(token_id)
255255

256+
# TODO: this is a temporary fix because if we don't do this, it
257+
# will do the update every time because of the cache. This
258+
# required unfreezing the TokenLookupResult class, which is not
259+
# ideal.
260+
user_info.token_used = True
261+
256262
requester = create_requester(
257263
user_info.user_id,
258264
token_id,

synapse/storage/databases/main/registration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
logger = logging.getLogger(__name__)
4141

4242

43-
@attr.s(frozen=True, slots=True)
43+
@attr.s(slots=True)
4444
class TokenLookupResult:
4545
"""Result of looking up an access token.
4646

0 commit comments

Comments
 (0)