chore(crypto): Improve some docs

Co-authored-by: Denis Kasak <dkasak@termina.org.uk>
This commit is contained in:
Damir Jelić
2023-01-12 17:13:03 +01:00
parent 0e4f4d69b8
commit 151f87a417
2 changed files with 6 additions and 6 deletions

View File

@@ -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);

View File

@@ -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();