diff options
| author | tv <tv@krebsco.de> | 2026-12-01 04:54:24 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-12-01 04:54:24 +0000 |
| commit | 79396943ec9eee8ffd64669baaa3484fcad33feb (patch) | |
| tree | 7232a8b5dac3f6e51778c503605c74e1faeec96d /src/federation/store/set.rs | |
| parent | 2d72ed5272f1be73b11bc4af5073385d6f905e0c (diff) | |
federation: the store's worker looks when something changed, not every five seconds
Every five seconds it looked at the changes screening refused, wrote its
set of events to its file, and read its store anew. It now looks where
screening refuses a change, writes the set five seconds after it
changed, and wakes for what the set is to let go of. A node voting by
itself still looks every five seconds: its rules count time.
Diffstat (limited to 'src/federation/store/set.rs')
| -rw-r--r-- | src/federation/store/set.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/federation/store/set.rs b/src/federation/store/set.rs index 8c2be6d..a31d9bd 100644 --- a/src/federation/store/set.rs +++ b/src/federation/store/set.rs @@ -485,6 +485,21 @@ impl<F: Fold> Set<F> { self.beside.len() != before } + /// How long, at `now`, until the document lets go of something a checkpoint forgot + /// (`expire`), if it keeps any. + pub(crate) fn next_expiry(&self, now: Instant) -> Option<Duration> { + self.beside + .values() + .filter_map(|(_, why)| match why { + Beside::Forgotten(since) => Some( + (*since + self.keeps_forgotten).saturating_duration_since(now) + + Duration::from_millis(1), + ), + _ => None, + }) + .min() + } + /// The bytes of an event the document gives to others: one its store holds, one /// held beside it, or one the store holds back. pub(crate) fn get(&self, id: &Id) -> Option<&[u8]> { |
