Adds the ability to apply backpressure to the Limiter.
Adds the ability to apply backpressure to the Limiter.
The ack
parameter can be used to signal to the
Limiter that backpressure should be applied depending on the
result of job
. Note that this will only change the
processing rate: it won't do any error handling for you.
Every time a job signals backpressure is needed, the Limiter
will adjust its current rate by applying backOff
to it. This
means the rate will be adjusted by calling backOff
repeatedly whenever multiple consecutive jobs signal for
backpressure, and reset to its original value when a job
signals backpressure is no longer needed.
Note that since jobs submitted to the Limiter are processed asynchronously, rate changes might not propagate instantly when the rate is smaller than the job completion time. However, the rate will eventually converge to its most up-to-date value.
Also see syntax.backpressure
A purely functional, interval based rate limiter.
Models the job processing rate Also see syntax.rate