Learn R Programming

crew (version 0.5.0)

crew_retry: Retry code.

Description

Repeatedly retry a function while it keeps returning FALSE and exit the loop when it returns TRUE

Usage

crew_retry(
  fun,
  args = list(),
  seconds_interval = 1,
  seconds_timeout = 60,
  max_tries = Inf,
  error = TRUE,
  message = character(0),
  envir = parent.frame()
)

Value

NULL (invisibly).

Arguments

fun

Function that returns FALSE to keep waiting or TRUE to stop waiting.

args

A named list of arguments to fun.

seconds_interval

Nonnegative numeric of length 1, number of seconds to wait between calls to fun.

seconds_timeout

Nonnegative numeric of length 1, number of seconds to loop before timing out.

max_tries

Maximum number of calls to fun to try before giving up.

error

Whether to throw an error on a timeout or max tries.

message

Character of length 1, optional error message if the wait times out.

envir

Environment to evaluate fun.

See Also

Other utilities: crew_assert(), crew_deprecate(), crew_eval(), crew_random_name(), crew_worker()

Examples

Run this code
crew_retry(fun = function() TRUE)

Run the code above in your browser using DataLab