Skip to main content

throttle

Function throttle 

Source
pub fn throttle(
    core: &Core,
    binding: &Arc<dyn ProducerBinding>,
    source: NodeId,
    ms: u64,
    opts: ThrottleOpts,
) -> NodeId
Expand description

Rate-limits upstream emissions to at most one per ms-millisecond window.

With default options (leading: true, trailing: false), the first DATA in each window is emitted immediately; subsequent DATA within the window is dropped. With trailing: true, the latest DATA is emitted at window end.

On upstream COMPLETE, flushes trailing (if any) then completes.