Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: retry configuration and onError callback #194

Open
stewerner opened this issue Oct 21, 2024 · 0 comments
Open

FR: retry configuration and onError callback #194

stewerner opened this issue Oct 21, 2024 · 0 comments

Comments

@stewerner
Copy link

stewerner commented Oct 21, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant