Skip to content

Commit

Permalink
make wait_until testable
Browse files Browse the repository at this point in the history
  • Loading branch information
chainsawriot committed Nov 16, 2022
1 parent d998f2f commit 6678df4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ sayif <- function(verbose, ...) {
}

# inspired by rtweet
wait_until <- function(until,verbose = TRUE){
wait_until <- function(until, from = Sys.time(), verbose = TRUE){
until <- as.numeric(until)
seconds <- ceiling(until - unclass(Sys.time()))
seconds <- ceiling(until - unclass(from))
if(seconds>0){
sayif(verbose,"Rate limit exceeded, waiting for ",seconds," seconds")
Sys.sleep(seconds)
Expand Down

0 comments on commit 6678df4

Please sign in to comment.