Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit e3837343 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

feat: implement per-account token refresh synchronization

Introduces a more granular, per-account locking mechanism for refreshing OAuth tokens in `OidcTokenRefresher`. This change replaces the global `synchronized` block with account-specific locks, allowing different accounts to refresh their tokens in parallel.

This mitigates race conditions for a single account while improving performance by not blocking token refreshes for unrelated accounts.

Key changes:
- Use `ConcurrentHashMap` to manage locks and track ongoing refresh operations for each account.
- If a token refresh is already in progress for an account, subsequent requests for the same account will wait for the ongoing operation to complete.
- In `AccountRemovedReceiver`, a cleanup routine is added to remove the corresponding lock and any tracked operations when an account is deleted, preventing memory leaks.
parent 15a8ea4b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment