psolymos / clickrup

Interacting with the ClickUp v2 API from R
https://peter.solymos.org/clickrup/
MIT License
18 stars 3 forks source link

Retry when rate limits are hit #8

Closed krlmlr closed 2 years ago

krlmlr commented 2 years ago

I tried with httr::RETRY(), a home-grown solution works better because RETRY() doesn't take into account the x-ratelimit-reset header.

library(clickrup)
#> clickrup 0.0.3    2021-04-09
for (i in 1:250) {
  message("#", appendLF = FALSE)
  cu_get_teams()
}
#> #
#> ####################################################################################################ClickUp API: Rate limit reached, sleeping for 54 seconds.
#> ####################################################################################################ClickUp API: Rate limit reached, sleeping for 53 seconds.
#> #################################################

message()
#> 

Created on 2021-10-02 by the reprex package (v2.0.1)