The returned Observer will proxy updates from the input observer but will delay the propagation of each update by some duration between 0 ms and lag + jitter. In addition, if an update arrives while no preceding jittered updates are still in flight, then the delay applied to the latest update will be a uniformly random duration between lag - jitter and lag + jitter.
Declared in <folly/observer/WithJitter.h>
template<typename T>
Observer<T>
withJitter(
Observer<T> observer,
std::chrono::milliseconds lag,
std::chrono::milliseconds jitter);
An Observer that proxies updates with jittered delays.
| Name | Description |
|---|---|
| observer | The input observer whose updates are proxied. |
| lag | The base delay applied to each propagated update. |
| jitter | The random spread added to or subtracted from the lag. |