Function rateLimitLossy

  • Limits the amount (count) of events passing the observable in the given time (slidingWindowTime). Events exceeding the limit will be skipped until capacity is available again.

    Use case :

    • buffer an observable of messages that should be send to the server
    • use a combined buffer closing notifier: interval and explicit (subject)
    • limit the amount of buffer closings to not send to much requests to the server

    It uses token bucket algorithm. There are specified amount of tokens. Once a value is emitted, it consumes a token. Tokens are regenerated after a the given time. It allows for short bursts of values to go through. When there are no tokens left, the value will be skipped. New values will pass the limiter as soon as there are tokens available again.

    Type Parameters

    • T

    Parameters

    • count: number
    • slidingWindowTime: number
    • scheduler: SchedulerLike = asyncScheduler

    Returns OperatorFunction<T, T>

Generated using TypeDoc