Add retention period to RecoveryConfig#2329
Open
wyfo wants to merge 4 commits intoeclipse-zenoh:mainfrom
Open
Conversation
Each source state get an additional latest access timestamp which is incremented at each access. A garbage collection task is spawned to periodically check the least recently used source states, to decide if they should be garbage collected. Alive publishers, as per spawned liveliness subscriber, are never garbage collected; there latest access is updated instead. `lru` library is used to avoid making a full scan of the source states' lists at each garbage collection. Removing a source state must also clean up the periodic query associated to it. `zenoh_util::Timer` is not built for this use case (and it is badly designed anyway), so it has been replaced by raw tokio tasks. Using `tokio_util::task::AbortOnDropHandle` makes tasks cleanup very easy.
|
PR missing one of the required labels: {'api-sync', 'bug', 'dependencies', 'breaking-change', 'documentation', 'internal', 'ci', 'new feature', 'enhancement'} |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2329 +/- ##
==========================================
- Coverage 72.97% 72.82% -0.16%
==========================================
Files 388 388
Lines 62200 62309 +109
==========================================
- Hits 45391 45377 -14
- Misses 16809 16932 +123 ☔ View full report in Codecov by Sentry. |
zenoh-ext/src/advanced_subscriber.rs
Outdated
| token: None, | ||
| _gc_task: AbortOnDropHandle::new(ZRuntime::Application.spawn(gc_task( | ||
| weak.clone(), | ||
| retransmission.as_ref().and_then(|r| r.retention_period), |
Contributor
There was a problem hiding this comment.
Why not unwrap_or retention period immediately instead of passing an option which will be unwrapped anyways inside gc_task ?
DenisBiryukov91
approved these changes
Dec 23, 2025
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.
Each source state get an additional latest access timestamp which is incremented at each access. A garbage collection task is spawned to periodically check the least recently used source states, to decide if they should be garbage collected.
Alive publishers, as per spawned liveliness subscriber, are never garbage collected; there latest access is updated instead.
lrulibrary is used to avoid making a full scan of the source states' lists at each garbage collection.Removing a source state must also clean up the periodic query associated to it.
zenoh_util::Timeris not built for this use case (and it is badly designed anyway), so it has been replaced by raw tokio tasks. Usingtokio_util::task::AbortOnDropHandlemakes tasks cleanup very easy.