pub struct SyncPolicy {
pub interval: Duration,
pub min_interval: Duration,
pub backoff: Backoff,
pub offline_retry: Duration,
pub max_throttle: Duration,
}Expand description
When a target should be synchronised.
The same engine serves a one-minute notification poll and a six-hour analytics refresh — only these numbers differ.
Fields§
§interval: DurationCadence while everything is healthy.
min_interval: DurationFloor between two runs, however often a refresh is requested.
Protects against a user holding the refresh button and against a UI that re-syncs on every window focus.
backoff: BackoffHow to back off after failures.
offline_retry: DurationRetry delay while the machine appears to be offline.
Short and flat rather than exponential: connectivity usually returns in one step, and backing off for half an hour would leave the app stale long after the network came back.
max_throttle: DurationThe longest a service may push this target’s next run into the future.
A service-reported throttle (quota reset, X-Poll-Interval) is honoured up
to this bound. Without it, a buggy or hostile response could freeze a target
indefinitely; past the bound the delay is clamped and a warning is logged.
Implementations§
Source§impl SyncPolicy
impl SyncPolicy
pub fn with_min_interval(self, min_interval: Duration) -> Self
pub fn with_backoff(self, backoff: Backoff) -> Self
pub fn with_offline_retry(self, offline_retry: Duration) -> Self
pub fn with_max_throttle(self, max_throttle: Duration) -> Self
Trait Implementations§
Source§impl Clone for SyncPolicy
impl Clone for SyncPolicy
Source§fn clone(&self) -> SyncPolicy
fn clone(&self) -> SyncPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more