Subscription policies
Channels & subscriptions
The first available sample is delivered immediately. Each later max_rate_hz period includes callback time, so the SDK waits only for the remainder. If a callback takes longer than the period, delivery continues with the next available sample, without catch-up deliveries. The rate uses the time from first to last delivery and allows one extra sample at the window boundary. To measure delivery intervals, record the monotonic time when each sample arrives and subtract consecutive readings. async for follows the same timing rules.
Callback time counts toward the period starting in Core/Glove 1.6.0. See Migration when upgrading older code.
Defines delivery for a subscription view used through with_config(). It affects subsequent subscriptions, not latest(), next(), existing subscriptions, or SDK/algorithm computation rates.
SubscriptionConfig.latest()
Deliver only the newest value in each pacing interval.
Type
SubscriptionConfig.latest(max_rate_hz: float | None = None) -> SubscriptionConfigParameters
max_rate_hz: defaults toNonewith no delivery rate cap; a supplied value must be positive and finite.
Returns
Details
- Call conditions: Configuring callbacks or async iteration.
Errors
- Invalid rate.
Example
from qnbot_sdk import SubscriptionConfig
config = SubscriptionConfig.latest(max_rate_hz=30)Complete example: subscription_config.py.
See also
SubscriptionConfig.fifo()
Use a bounded ordered queue; drop the oldest item when full.
Type
SubscriptionConfig.fifo(capacity: int, max_rate_hz: float | None = None) -> SubscriptionConfigParameters
capacity: required and positive; a full queue discards the oldest pending value.max_rate_hz: defaults toNonewith no delivery rate cap; a supplied value must be positive and finite.
Returns
Details
- Call conditions: Configuring callbacks or async iteration.
Errors
- Invalid capacity or rate.
Example
from qnbot_sdk import SubscriptionConfig
config = SubscriptionConfig.fifo(capacity=128, max_rate_hz=30)Complete example: subscription_config.py.
See also