Skip to content

Conversation

reivilibre
Copy link
Contributor

@reivilibre reivilibre commented Mar 17, 2025

Closes #4224

Corresponds to: element-hq/synapse#18231

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 17, 2025

Deploying matrix-authentication-service-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 910630c
Status: ✅  Deploy successful!
Preview URL: https://30804163.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://rei-expires-in.matrix-authentication-service-docs.pages.dev

View logs

@reivilibre reivilibre requested a review from sandhose March 17, 2025 09:42
@reivilibre reivilibre marked this pull request as ready for review March 17, 2025 09:42
Copy link
Member

@sandhose sandhose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the small serialisation tweak, lgtm

@reivilibre reivilibre requested a review from sandhose March 17, 2025 10:30
@reivilibre reivilibre merged commit f73b5df into main Mar 17, 2025
21 checks passed
@reivilibre reivilibre deleted the rei/expires_in branch March 17, 2025 11:10
reivilibre added a commit to element-hq/synapse that referenced this pull request Apr 1, 2025
… Service integration (MSC3861) more efficient. (#18231)

Evolution of
cd78f3d

This cache does not have any explicit invalidation, but this is deemed
acceptable (see code comment).

We may still prefer to add it eventually, letting us bump up the
Time-To-Live (TTL) on the cache as we currently set a 2 minute expiry
to balance the fact that we have no explicit invalidation.


This cache makes several things more efficient:

- reduces number of outbound requests from Synapse, reducing CPU
utilisation + network I/O
- reduces request handling time in Synapse, which improves
client-visible latency
- reduces load on MAS and its database


---

Other than that, this PR also introduces support for `expires_in`
(seconds) on the introspection response.
This lets the cached responses expire at the proper expiry time of the
access token, whilst avoiding clock skew issues.

Corresponds to:
element-hq/matrix-authentication-service#4241

---------

Signed-off-by: Olivier 'reivilibre <[email protected]>
@sandhose sandhose added A-Homeserver-Integration Integration with the homeserver T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. labels Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Homeserver-Integration Integration with the homeserver T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MAS should expose expires_in of access tokens alongside expires_at to counteract clock skew issues

2 participants