Background: I'd like to create a shiny app which is able to reconnect to a database once the connection is lost (without crashing the active shiny session).
Currently, when using dbPool and the database server is shutdown (I stopped the PostgreSQL service for testing) after successfully establishing a connection, {pool} will retry 2 times and throw an error after a few seconds (default validationInterval = 60):
Failed to activate and/or validate existing object.
Trying again with a new object.
Error: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
Error: invoke_wrapped: throwing std::runtime_error
Unfortunately, (afaik) I don't have the possibility to configure this behaviour, e.g. retry 5 times wait x seconds or retry forever.
Furthermore, as this is happening in a background process I can't use tryCatch to write my own error handling for this case (also afaik) - maybe a onError callback could be added?
I would be pleased to hear your opinion on this - cheers
Background: I'd like to create a shiny app which is able to reconnect to a database once the connection is lost (without crashing the active shiny session).
Currently, when using
dbPooland the database server is shutdown (I stopped the PostgreSQL service for testing) after successfully establishing a connection, {pool} will retry 2 times and throw an error after a few seconds (defaultvalidationInterval = 60):Unfortunately, (afaik) I don't have the possibility to configure this behaviour, e.g. retry 5 times wait x seconds or retry forever.
Furthermore, as this is happening in a background process I can't use
tryCatchto write my own error handling for this case (also afaik) - maybe aonErrorcallback could be added?I would be pleased to hear your opinion on this - cheers