Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

Commit

Permalink
Only set max open connections if provided in ConnectionSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Mathews committed Dec 4, 2020
1 parent 85af949 commit cd0e2e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ func (settings *ConnectionSettings) Init() *sqlx.DB {
log.Fatal(fmt.Sprintf("Could not connect to or ping database '%v': %v", settings.Database, settings.String()))
}

// Setting these arbitrarily to 50. We need to set a MaxOpenConns here since Oatmeal
// uses channels during OrderProcessing and we don't want to hit any connection limits.
db.SetMaxOpenConns(settings.MaxOpenConns)
if (settings.MaxOpenConns > 0 {
db.SetMaxOpenConns(settings.MaxOpenConns)
})

return db
}
Expand Down

0 comments on commit cd0e2e5

Please sign in to comment.