View source: R/crew_throttle.R
crew_throttle | R Documentation |
Create an R6
object for throttling.
crew_throttle(
seconds_max = 1,
seconds_min = 0.001,
seconds_start = seconds_min,
base = 2
)
seconds_max |
Positive numeric scalar, maximum throttling interval |
seconds_min |
Positive numeric scalar, minimum throttling interval. |
seconds_start |
Positive numeric scalar,
the initial wait time interval in seconds.
The default is |
base |
Numeric scalar greater than 1, base of the exponential
backoff algorithm. |
Throttling is a technique that limits how often a function is
called in a given period of time. crew_throttle()
objects support
the throttle
argument of controller methods, which ensures auto-scaling
does not induce superfluous overhead.
The throttle uses deterministic exponential backoff algorithm
(https://en.wikipedia.org/wiki/Exponential_backoff) which
increases wait times when there is nothing to do and decreases
wait times when there is something to do. The controller decreases
or increases the wait time with methods accelerate()
and decelerate()
in the throttle object, respectively,
by dividing or multiplying by base
(but keeping the wait time
between seconds_min
and seconds_max
).
In practice, crew
calls reset()
instead of update()
in order to respond quicker to surges of activity (see the
update()
method).
An R6
object with throttle configuration settings and methods.
Other throttle:
crew_class_throttle
throttle <- crew_throttle(seconds_max = 1)
throttle$poll()
throttle$poll()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.