mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-15 03:25:46 -04:00
chore(crypto): Improve some docs
Co-authored-by: Denis Kasak <dkasak@termina.org.uk>
This commit is contained in:
@@ -174,10 +174,10 @@ impl IdentityManager {
|
||||
.filter(|s| s != self.user_id().server_name());
|
||||
let successful_servers = response.device_keys.keys().map(|u| u.server_name());
|
||||
|
||||
// Append the new failed servers and remove any successful servers. We remove
|
||||
// the successful servers explicitly so we keep incrementing the delay
|
||||
// on the failed servers instead of removing them when the entry times
|
||||
// out.
|
||||
// Append the new failed servers and remove any successful servers. We
|
||||
// need to explicitly remove the successful servers because the cache
|
||||
// doesn't automatically remove entries that elapse. Instead, the effect
|
||||
// is that elapsed servers will be retried and their delays incremented.
|
||||
self.failures.extend(failed_servers);
|
||||
self.failures.remove(successful_servers);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ where
|
||||
/// A TTL cache where items get inactive instead of discarded.
|
||||
///
|
||||
/// The items need to be explicitly removed from the cache. This allows us to
|
||||
/// implement a exponential backoff based TTL.
|
||||
/// implement exponential backoff based TTL.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct FailuresCache<T: Eq + Hash> {
|
||||
inner: Arc<RwLock<HashMap<T, FailuresItem>>>,
|
||||
@@ -112,7 +112,7 @@ where
|
||||
/// Extend the cache with the given iterator of items.
|
||||
///
|
||||
/// Items that are already part of the cache, whether they are expired or
|
||||
/// not, will have their TTL extended using a exponential backoff
|
||||
/// not, will have their TTL extended using an exponential backoff
|
||||
/// algorithm.
|
||||
pub fn extend(&self, iterator: impl Iterator<Item = T>) {
|
||||
let mut lock = self.inner.write().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user