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()
)
Arguments
- fun
Function that returns
FALSE
to keep waiting orTRUE
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 utility:
crew_assert()
,
crew_clean()
,
crew_deprecate()
,
crew_eval()
,
crew_random_name()
,
crew_terminate_process()
,
crew_terminate_signal()
,
crew_worker()