Hello! This is a fantastic question!
When users visit your application on RStudio Connect, they are connected to a running R process. Each R process, when it starts, will run the
app.R file and thus source the
data.R script. However, each R process can live for a while, depending on your settings inside of RStudio Connect. I.e. if there is a steady stream of visitors or Minimum Processes > 0 (in Scaling Settings), then an R process could stick around for a long time.
Further, it is worth noting that many R processes can be run at once. RStudio Connect will start new R processes as needed if many visitors visit the application (based on the "Scaling Settings" in the Connect UI).
I'm curious what your thoughts are regarding the above! Does that seem to work naturally for your use case?