If I do long calculations in global.R my chrome browser runs into a hard 30 second timeout because shiny-server does not respond.
Some time after chrome disconnects shiny-server will stop the (still initializing) app because it runs into app_idle_timeout. Next time I try to access the page it starts from the beginning and runs into a timeout again. The app appears to be not working.
Cache the data somewhere and let the app load the data from cache.
But you have to maintain the cache and that is always a hard problem.
The manual
Increase app_idle_timeout to make sure your app has enough time to start. Then just click reload in your browser after some minutes. It will connect to the now running app.
However, if you wait too long, shiny will kill the app after app_idle_timeout.
The ugly
Create an html page, that contains an iframe pointing to your app. After n seconds (typical start time < n < app_idle_timeout) forward the browser to the real app using a meta refresh tag.
That way, if the browser is left alone, it will eventually open the app and keep it running.
The default <- This is the feature request
If an app is initializing and the browser has been waiting for more than 20s, create an info page that shows "app initializing since 123s" and refresh this page every 20s.
Show an error if initializing takes longer than app_init_timeout
Probably the 20s wait should be configurable.
This solution would work reasonably out of the box. If you want it fast, you got to cache.
This is the same as https://github.com/rstudio/shiny/issues/2967 but I think it's more appropriate here on shiny-server:
If I do long calculations in global.R my chrome browser runs into a hard 30 second timeout because shiny-server does not respond. Some time after chrome disconnects shiny-server will stop the (still initializing) app because it runs into
app_idle_timeout
. Next time I try to access the page it starts from the beginning and runs into a timeout again. The app appears to be not working.There are various workarounds for this problem:
The progressive lazy
Lazy load the data (in server.R) and show a progress bar. This is inconvenient to develop though. And the user still has to wait.
The fast
Cache the data somewhere and let the app load the data from cache. But you have to maintain the cache and that is always a hard problem.
The manual
Increase
app_idle_timeout
to make sure your app has enough time to start. Then just click reload in your browser after some minutes. It will connect to the now running app. However, if you wait too long, shiny will kill the app afterapp_idle_timeout
.The ugly
Create an html page, that contains an iframe pointing to your app. After n seconds (typical start time < n <
app_idle_timeout
) forward the browser to the real app using a meta refresh tag. That way, if the browser is left alone, it will eventually open the app and keep it running.The default <- This is the feature request
If an app is initializing and the browser has been waiting for more than 20s, create an info page that shows "app initializing since 123s" and refresh this page every 20s. Show an error if initializing takes longer than
app_init_timeout
Probably the 20s wait should be configurable.This solution would work reasonably out of the box. If you want it fast, you got to cache.