Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memoize the Oidc::account_management_url() method #4663

Merged
merged 4 commits into from
Feb 13, 2025

Conversation

poljar
Copy link
Contributor

@poljar poljar commented Feb 12, 2025

This will hopefully fix #4460.

  • Public API changes documented in changelogs (optional)

@poljar poljar requested a review from a team as a code owner February 12, 2025 16:36
@poljar poljar requested review from jmartinesp and removed request for a team February 12, 2025 16:36
@poljar poljar force-pushed the poljar/cache-for-account-management-url branch from 20b2558 to 7f78661 Compare February 12, 2025 16:37
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 87.17949% with 5 lines in your changes missing coverage. Please review.

Project coverage is 85.79%. Comparing base (31e78c2) to head (be6f567).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk-common/src/ttl_cache.rs 88.00% 3 Missing ⚠️
crates/matrix-sdk/src/authentication/oidc/mod.rs 80.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4663   +/-   ##
=======================================
  Coverage   85.78%   85.79%           
=======================================
  Files         292      293    +1     
  Lines       33729    33769   +40     
=======================================
+ Hits        28936    28973   +37     
- Misses       4793     4796    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@poljar poljar force-pushed the poljar/cache-for-account-management-url branch from 7f78661 to cef565c Compare February 12, 2025 17:00
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks!


/// Force the expiry of the given item, if it is present in the cache.
///
/// This doesn't remove the item, it just marks it as expired.
Copy link
Member

Choose a reason for hiding this comment

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

Why not remove it immediately? If it's expired, is there any point in keeping it in the mapping?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That method is for testing purposes mostly, perhaps I should make itcfg(test).

It expires the item and then we check that a get() correctly removes it.

Copy link
Member

Choose a reason for hiding this comment

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

Fair!

@poljar poljar force-pushed the poljar/cache-for-account-management-url branch from d114fee to f59bdc4 Compare February 13, 2025 11:07
@poljar poljar enabled auto-merge (rebase) February 13, 2025 11:09
@poljar poljar force-pushed the poljar/cache-for-account-management-url branch from f59bdc4 to be6f567 Compare February 13, 2025 11:17
@poljar poljar merged commit 861078a into main Feb 13, 2025
41 checks passed
@poljar poljar deleted the poljar/cache-for-account-management-url branch February 13, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement pre-loading and cache for account management URLs
3 participants