Skip to contents

R6 class for throttle configuration.

Details

See crew_throttle().

See also

Other throttle: crew_throttle()

Active bindings

seconds_interval

Positive numeric of length 1, throttling interval in seconds.

polled

Positive numeric of length 1, millisecond timestamp of the last time poll() returned TRUE. NULL if poll() was never called on the current object.

Methods


Method new()

Throttle constructor.

Usage

crew_class_throttle$new(seconds_interval = NULL)

Arguments

seconds_interval

Throttling interval in seconds.

Returns

An R6 object with throttle configuration.

Examples

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


Method validate()

Validate the object.

Usage

crew_class_throttle$validate()

Returns

NULL (invisibly).


Method poll()

Poll the throttler.

Usage

crew_class_throttle$poll()

Returns

TRUE if poll() did not return TRUE in the last seconds_interval seconds, FALSE otherwise.


Method reset()

Reset the throttle object so the next poll() returns TRUE.

Usage

crew_class_throttle$reset()

Returns

NULL (invisibly).

Examples

throttle <- crew_throttle(seconds_interval = 0.5)
throttle$poll()
#> [1] TRUE
throttle$poll()
#> [1] FALSE

## ------------------------------------------------
## Method `crew_class_throttle$new`
## ------------------------------------------------

throttle <- crew_throttle(seconds_interval = 0.5)
throttle$poll()
#> [1] TRUE
throttle$poll()
#> [1] FALSE