A no-op when the host has no pause recorded, or the recorded one has
already elapsed. sleep is injectable so a test can assert the duration
asked for without actually waiting for it.
Usage
ratelimit_wait(host, now = as.numeric(Sys.time()), sleep = Sys.sleep)Arguments
- host
A hostname.
- now
The current time in seconds since the epoch.
- sleep
The sleep function to call with the remaining seconds. Defaults to
Sys.sleep().
Examples
ratelimit_reset()
ratelimit_wait("rest.ensembl.org")