LIFESPAN
Controls how long a sample published by a Publisher remains valid.
What it controls
The expiration duration for samples in the Writer HistoryCache. Expired samples are not delivered to new or existing Readers.
Key settings
| Field | Default | Mutability |
|---|---|---|
duration |
infinity | Can be changed at runtime |
Compatibility role
Timing and cache — limits how long samples remain deliverable. Interacts with deadline period, history depth, resource limits, durability, and reliable delivery windows.
When this conflicts
Lifespan takes part in the following QoS Guard rules. Each links to a full explanation with an example and a fix.
Related policies
Example
The LFSPAN QoS can be used to prevent robots from retaining outdated samples unnecessarily. For data such as position or battery level, where only the last few seconds matter, setting the duration accordingly ensures that the Publisher's HistoryCache stores only the most recent samples, with older ones automatically deleted to conserve memory. In contrast, for data such as command logs, where long-term delivery is more important than freshness, it is preferable to set duration to infinity and rely on other QoS policies to ensure reliability.