Renew config message TTLs at most once an hour per swarm - #2225
Merged
mpretty-cyro merged 3 commits intoSep 28, 2026
Merged
mpretty-cyro merged 3 commits into
mpretty-cyro merged 3 commits into
Conversation
Every poll asked the swarm to extend the TTL of every active config message, which is a write on each storage node holding them, every few seconds, from every client. Service nodes see real disk I/O from it. The extension is now skipped for a swarm whose last extension succeeded within the hour. The user swarm and each group swarm are tracked separately. A failed extension leaves the cooldown untouched so the next poll retries it. State is in memory only, so the first poll after launch always extends.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every poll asked the swarm to extend the TTL of every active config message. That is a write on every storage node holding those messages, every few seconds, from every client, and service nodes see real disk I/O from it. The extension goes to weeks from now, so doing it once an hour loses nothing.
The change
A poll now skips the config TTL extension for a swarm whose last extension succeeded within the last hour.
Disappearing-message expiry uses a separate path and is unchanged.
Android specifics
ConfigTtlExtensionThrottle(@Singleton, monotonicTimeSource) holds the per-swarm timestamps.PollerandGroupPollerwrap their existingAlterTtlApiextend inextendIfDue(swarmPubKeyHex) { … }.SnodeApiBatcherhands each sub-request its ownhandleResponseresult, andAbstractSnodeApithrows on non-2xx. So a 500 on just the expire, or a failure of the whole batch, throws inside the closure and nothing is recorded. The due check does not suspend, so it doesn't push the extend outside the 100ms batching window.Verification
ConfigTtlExtensionThrottleTest, 8 tests usingTestTimeSource: two polls inside the window send one; the window is still closed just before an hour; a poll after the window sends another; a failed, repeatedly failing, or cancelled extension doesn't start the cooldown; per-swarm independence. 8/8 ontestPlayDebugUnitTest. With the timestamp set beforeextend()instead of after, exactly the 4 failure-path tests go red.Same change in the other clients