Commit df4a2d62 authored by Will Cory's avatar Will Cory

cleaner again

parent a51c60a3
......@@ -50,12 +50,18 @@ func NewDB(dbConfig config.DBConfig) (*DB, error) {
Logger: logger.Default.LogMode(logger.Silent),
}
db, err := retry.Do[*DB](context.Background(), 10, retryStrategy, func() (*DB, error) {
gorm, err := retry.Do[*gorm.DB](context.Background(), 10, retryStrategy, func() (*gorm.DB, error) {
gorm, err := gorm.Open(postgres.Open(dsn), &gormConfig)
if err != nil {
return nil, errors.Wrap(err, "failed to connect to database")
}
return gorm, nil
})
if err != nil {
return nil, errors.Wrap(err, "failed to connect to database after multiple retries")
}
db := &DB{
gorm: gorm,
......@@ -65,12 +71,7 @@ func NewDB(dbConfig config.DBConfig) (*DB, error) {
BridgeMessages: newBridgeMessagesDB(gorm),
BridgeTransactions: newBridgeTransactionsDB(gorm),
}
return db, nil
})
if err != nil {
return nil, errors.Wrap(err, "failed to connect to database after multiple retries")
}
return db, nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment