Hello, I have a few sets of Rmarkdown files on RStudio Connect that update nightly or hourly. In my shiny apps I then read the data globally in the app from S3 via reactivePoll. The time interval to check for new data is set for an hour, i.e. 3600000 milliseconds. It will run the check function, which checks a timestamp file that is generated at the end of each markdown run to track when the data was updated. I print the timestamp out when the check function runs so I can see it shows the newest file date but will not actually load the file as I don't see the print line from the value function happening.
If I hit the app enough times or re-deploy the app entirely the data will refresh. It seems like something is caching still. It's hard to recreate an example of this so a long shot that I'll get help but curious if anything stands out as completely wrong with how I'm using reactivePoll? Thoughts very welcome, thank you!
#Functions defined in global.R:
load_fst_file_rp <- function(file_name) {
reactivePoll(3600000, NULL,
checkFunc = check_upload_timestamp_fst,
valueFunc = function() {
load_fst_file(file_name)
})
}
check_upload_timestamp_fst <- function(){
timestamp <- save_object("timestamp.fst", bucket = bucket_name,
file = "timestamp.fst",check_region = FALSE) %>%
read_fst()
ts <- timestamp$ts
print(paste0("Checking upload timestamp fst: ", ts))
ts
}
load_fst_file <- function(file_name) {
print(paste0("Loading: ", file_name))
save_object(file_name), bucket = bucket_name, file = file_name,
check_region = FALSE) %>%
read_fst()
}
}
#app.R
source(global.R)
data <- load_fst_file_rp("data.fst")
ui <- function(request) {
#UI Stuff
}
server <- function(input, output, session) {
output$dataTable <- DT::renderDataTable({
data()
})
}
# Run the application
shinyApp(ui = ui, server = server)