I am trying to use promises/future in a code block that is taking too long in my shiny app. The problem is that i am using the httr package inside a loop to retrieve data, and this is the only way i can get data from the api. The problem is that i know that i can't use reactive/input values inside the future, but when i use the future in diferent parts of the code, nothing happen.
This is the code, the df is an empty dataframe with just the columns
for (i in 1:1000){
url<-glue("{api_domain}stats/conversions?date_from={input$date_start_conversions}&date_to={input$date_final_conversions}&offer={input$offer_id_conversions}&limit=5000&page={i}")
api_token<-Sys.getenv('API_TOKEN')
r = GET(url,add_headers("API-KEY"=api_token))
raw_response <- content(r, as="text")
json <- fromJSON(raw_response)
df_query<-as.data.frame(json$conversions)
df <- rbind(df, df_query)
if (nrow(df_query)==0) break
df
}
})