fix: renew config message TTLs at most once an hour per swarm - #2017
Merged
mpretty-cyro merged 1 commit intoSep 29, 2026
Merged
mpretty-cyro merged 1 commit into
mpretty-cyro merged 1 commit 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 was referenced Sep 28, 2026
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.
Desktop specifics
configTtlExtensionThrottle.tsholds a module-level per-swarm map.retrieveNextMessagesNoRetriesdecides whether to passconfigHashesToBumpon tobuildRetrieveRequest, and records success only when the expire sub-result (last in the batch, when present) returns 200.Date.now(), since this is a local interval rather than a comparison with a network value. A clock moved backwards counts as due.Verification
configTtlExtensionThrottle_test.ts, 6 tests throughretrieveNextMessagesNoRetrieswithBatchRequests.doUnsignedSnodeBatchRequestNoRetriesstubbed, counting the batches that actually contain anexpiresub-request. Covered: two polls inside the window send one; a poll after the window sends another; a 500 or a rejected batch doesn't start the cooldown; a backwards clock; per-swarm independence. ExistingbuildRetrieveRequesttests unchanged. tsc clean; prettier and eslint clean on the touched files. Three separate mutations (record regardless of code, drop the gate, drop the backwards-clock guard) each turn the expected tests red.Same change in the other clients