Open henning opened 2 years ago
This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days
I need this feature
any updates?
I just started googling this topic and landed on this stale issue. Any hints to prebuilt solutions would be of much help (if there are any)
I need this feature too.
Is there any solution now?
I am unable to replicate this in a Gin API application, i.e. it recovers automatically with a subsequent request.
has this feature been implemented?
Describe the feature
GORM should try to reconnect to a database when connection is lost (e.g. Network error, DB restart)
After the DB restarts, the gorm application usually isnt able to recover and get back to normal operations. That should be solved.
To reproduce the behaviour that I want to avoid - working with Postgres, I get:
Expecation would be that the application reconnects to the DB and continue to work without a restart.
Motivation
GORM applications without DB connection do not work very well.
Related Issues
Multiple issues have been created with that, but all have been closed, but without mentioning a reason or a workaround:
https://github.com/go-gorm/gorm/issues?q=reconnect
There are also some chat messages about it: https://gitter.im/jinzhu/gorm?at=5a59df94ba39a53f1a0e36f2 - but it's not clear to me why gorm doesn't come out of the box with that reconnect behaviour - are there important downsides to configure it by default to reconnect automatically?
I'd be happy to try find a solution for that thing or add some documentation with a workaround if I get some guidance for more experienced gorm developers about how to do it best... maybe there is a reason why it has not been implemented before, or maybe I am overseeing something that makes it not a useful feature.