yesodweb / yesodweb/persistent
Catching errors when connecting to database
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
When the database is under maintenance or similar, runSqlPool and similar unsurprisingly throw an exception.
We want to catch that exception during the connecting stage, so we can wait briefly and then try again.
However catching the entire runSqlPool call will also catch any errors that occur after a successful connection, which I do not want to lead to a retry.
I'm curious if I am missing something and there already is a safe and easy way to do such a thing, but if not it'd be very useful if it were supported.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the runSqlPool entry point and similar database operations to identify which part represents the connecting stage. Clarify the proposed retry boundary and behavior for connection failures versus errors after a successful connection. Done means the supported behavior and its scope are documented and covered by relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100