wait_until: Wait until a condition is met

View source: R/wait.R

wait_untilR Documentation

Wait until a condition is met

Description

Block the current runtime until the expression returns TRUE.

Usage

wait_until(
  expr,
  envir = parent.frame(),
  timeout = Inf,
  interval = 0.1,
  later_run_now = TRUE
)

Arguments

expr

an expression to check, supports quasiquotation.

envir

the environment in which the expression is to be evaluated.

timeout

raise an error if this amount of time in second has passed.

interval

delay between retries.

later_run_now

execute later::run_now() periodically later is loaded?

Examples


s <- Sys.time()
system.time(wait_until(Sys.time() - s > 1))

z <- 0
later::later(function() z <<- 1, 1)
wait_until(z == 1)
z == 1


retry documentation built on May 29, 2024, 9:32 a.m.