R/global.R

Defines functions api_delay

# OpenDota API rules : Limit 1 call per second
api_delay <- function(start_time, wait_time = 1.00) {
  end_time <- proc.time()[3]
  tot_time <- end_time - start_time

  if (tot_time <= wait_time) {
    Sys.sleep(wait_time - tot_time)
  }
}

Try the ROpenDota package in your browser

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

ROpenDota documentation built on May 2, 2019, 6:43 a.m.