R/rate_limit.R

Defines functions enforce_rate_limit

# enforce rate limits
enforce_rate_limit <- function() {
  if (!Sys.getenv('rbace_time') == "") {
    timesince <- as.numeric(Sys.time()) - as.numeric(Sys.getenv('rbace_time'))
    if (timesince < 1) Sys.sleep(1 - timesince)
  }
}

Try the rbace package in your browser

Any scripts or data that you put into this service are public.

rbace documentation built on Jan. 13, 2021, 6:08 a.m.