When does the code get rerun or will my data be up to date

Hello there,
recently I developed and deployed my very first shiny app on shinyapp.io and I am very happy how easy the procedure was. However I wonder about what happens when the app goes from sleeping to running. Does the code get rerun? I'm asking because one of my input data originates from an online stored csv file (stashed in a github repo). I bluntly accessed and loaded it by using

url_to_file <- "https://raw.githubusercontent.com/user/some_data.csv"
my_data <- read_csv(url_to_file)

So will my app be running on the latest available data (if the code gets rerun) or will the data be in the state of the publishing date?

Hi,

Welcome to the RStudio community!

This all depends on where the data is loaded in your Shiny app and at what time. Start by taking a look at the scoping rules here:
https://shiny.rstudio.com/articles/scoping.html

If a Shiny app is shut down and restarts, all variables should be loaded again, in other cases it depends on the scope. If you want your data to update on a regular interval you can look into the reactive polling concept, where the data on disk will be reloaded at a set interval if changed, or if you use a link it will pull it at that interval
https://shiny.rstudio.com/reference/shiny/1.6.0/reactivePoll.html

Hope this helps,
PJ

Hi,
thank you for the thorough answer! Both documentations are exactly the information I was looking for. I going to give it a read and optimize my app.

Thanks again,
Alf

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.