Skip to content

Conversation

@MichaelOrlov
Copy link
Contributor

Description

This PR adds the ability to limit the inner Recorder cache not only by size, but also by duration in seconds.
This is a more generic alternative to the "--snapshot-duration" CLI option implemented in the #1844

Originally, the implementation was planed to be made only for the snapshot mode to be used as a time bounded snapshot feature. However, it was generalized and the same "--max-cache-duration" CLI option can be used as a cache limiter for the regular recording.
Note: The max-cache-duration it is set to 0 by default for backward compatability behavior. i.e. only --max-cache-size cache limiter will be applied by default.

Is this user-facing behavior change?

Yes, a new "--max-cache-duration" CLI option was added

Did you use Generative AI?

Yes. GitHub Copilot, GPT-5 was used to help with unit tests and Doxygen comments.

Additional Information

This PR is not backportable, because it has API/ABI breaking changes.

morlov-apexai and others added 17 commits January 3, 2026 16:22
- Added the "--snapshot-duration" CLI option. Default value 0 indicates
that the snapshot will be limited by the --max-cache-size parameter
only. If the value is more than 0, the cyclic buffer for the snapshot
will be limited by both the series of messages duration and the maximum
cache size parameter.
- To override the upper bound by total messages size, the
"--maximum-cache-size" CLI option can be settled to 0.

Signed-off-by: Michael Orlov <[email protected]>
Signed-off-by: Michael Orlov <[email protected]>
Signed-off-by: Michael Orlov <[email protected]>
- Add ability to limit MessageCacheBuffer by duration in addition to
 the limit by the buffer size.

Signed-off-by: Michael Orlov <[email protected]>
- Rationale:
1. On practice there are no value to have cache in a fraction of seconds
 we can always limit by size as well.
2. It is much easier to operate with a plain integer type rather than
 rclcpp::Duration.
3. It would be good to avoid dependencies from the rclcpp layer in the
 StorageOptions data struct.

Signed-off-by: Michael Orlov <[email protected]>
Signed-off-by: Michael Orlov <[email protected]>
Signed-off-by: Michael Orlov <[email protected]>
@MichaelOrlov MichaelOrlov marked this pull request as ready for review January 4, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snapshot based on duration

3 participants