Hi!
I have an app where there is some initial loading latency in IE11. After posting my issue in shinyapps.io community, I got advised to use future/promises packages and apply this concept in order to load my 3 files in background at the same time. And after reading about async programming, I tried to implement the following:
I have three rds files to read, and then update the choices of selectinput accordingly.
Globally I have:
library(promises)
library(future)
plan(multiprocess)
promise_m <- future( readRDS("www/mouse.rds") )
promise_h <- future(readRDS("www/human.rds"))
promise_d <- future( readRDS("www/drosophila.rds") )
In the server shiny I have:
observeEvent(input$genome, {
options(future.globals.maxSize=1e9)
if (input$genome == "mouse"){
promise_m %>%
then(function(value){
updateSelectInput(session = session, inputId = "geneId_mouse", choices = print(value) )
})
} else if (input$genome == "human") {
promise_h %>%
then(function(value){
updateSelectInput(session = session, inputId = "geneId_human", choices = print(value))
})
} else {
promise_d %>%
then(function(value){
updateSelectInput(session = session, inputId = "geneId_drosophila", choices = print(value))
})
}
})
Reading these files cause initial latency in IE11, which makes the app freeze when I deploy it to the shinyapps.io, but locally it works fine. So I need to read these files at the same time in different R processors. But the above code still does not change the loading latency. My question is that how can I modify it or is there a process I should be aware of to solve this? Do I need to change number of CPU or any other settings when I deploy the app? Or is this has something to do with plan(multisession/multoprocess)?
I highly appreciate your advice!
Thank you for your support.
Best Regards,
Karni Bedirian