crew_throttle {crew}R Documentation

Create a stateful throttling object.

Description

Create an R6 object for throttling.

Usage

crew_throttle(seconds_interval = 0.5)

Arguments

seconds_interval

Positive numeric of length 1, throttling interval. The poll() method returns TRUE if and only if it was not called in the last seconds_interval seconds.

Details

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 only happen every seconds_interval seconds. This helps avoid overburdening the mirai dispatcher and other resources.

Value

An R6 object with throttle configuration settings and methods.

See Also

Other throttle: crew_class_throttle

Examples

throttle <- crew_throttle(seconds_interval = 0.5)
throttle$poll()
throttle$poll()

[Package crew version 0.9.5 Index]