From 151f87a4171c3ca4edfdebd76ce8128cc28f1a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 12 Jan 2023 17:13:03 +0100 Subject: [PATCH] chore(crypto): Improve some docs Co-authored-by: Denis Kasak --- crates/matrix-sdk-crypto/src/identities/manager.rs | 8 ++++---- crates/matrix-sdk-crypto/src/utilities.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/identities/manager.rs b/crates/matrix-sdk-crypto/src/identities/manager.rs index f7ba59e33..f20591a26 100644 --- a/crates/matrix-sdk-crypto/src/identities/manager.rs +++ b/crates/matrix-sdk-crypto/src/identities/manager.rs @@ -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); diff --git a/crates/matrix-sdk-crypto/src/utilities.rs b/crates/matrix-sdk-crypto/src/utilities.rs index 215434b9d..36d37d84e 100644 --- a/crates/matrix-sdk-crypto/src/utilities.rs +++ b/crates/matrix-sdk-crypto/src/utilities.rs @@ -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 { inner: Arc>>, @@ -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) { let mut lock = self.inner.write().unwrap();