I have built an application that is meant for monitoring a dataset 24/7/7. The app is deployed on RStudio Connect and is set not to time out. The data is invalidated every five minutes which triggers a call to the database to re-pull the updated dataset. As we have rolled out the application I still have people reporting that the app is disconnecting even when a DB restart hasn't occurred. I've had no luck finding any meaningful errors in the connect logs. I have the runtime settings setup so that the app doesn't timeout, the automated DB call every five minutes should be keeping the connection timeout from being hit but I even have set this to zero as well because the app was still disconnecting eventually. You can see my current application settings, maybe there is something else to change here?
My only thought is that something is happening to the database connection and the app tries to make a database call when the DB connection has been compromised somehow. I can't find any good information on how to check if my connection is still good before making the DB call. If the connection is bad I'd like to re-connect first. I was going to try using a pooled connection instead to see if that changed anything but I couldn't find any good information outlining what happens to the pool if for instance the database is down or restarted, would my app still get disconnected?
Ideally I can get my app to remain running even during downtime and a restart and just have the app try to re-connect to the db every 5 minutes. If the DB is down I'd like to capture that and display a message to the user. Are there any good examples out there of handling this in a shiny app?
Thanks in advance for any insights!