Skip to content

FR: retry configuration and onError callback #194

Description

@stewerner

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions