diff --git a/config/default.go b/config/default.go index f7371cbfdb..f33b10a2bf 100644 --- a/config/default.go +++ b/config/default.go @@ -20,7 +20,7 @@ Outputs = ["stderr"] Port = "5432" EnableLog = false MaxConns = 200 - MaxConnLifetime = 1h + MaxConnLifetime = "1h" [State.Batch] [State.Batch.Constraints] MaxTxsPerBatch = 300 diff --git a/db/db.go b/db/db.go index 1366f1355d..ab55170848 100644 --- a/db/db.go +++ b/db/db.go @@ -26,7 +26,7 @@ var packrMigrations = map[string]*packr.Box{ // NewSQLDB creates a new SQL DB func NewSQLDB(cfg Config) (*pgxpool.Pool, error) { - config, err := pgxpool.ParseConfig(fmt.Sprintf("postgres://%s:%s@%s:%s/%s?pool_max_conns=%d&pool_max_conn_lifetime=%d", cfg.User, cfg.Password, cfg.Host, cfg.Port, cfg.Name, cfg.MaxConns, cfg.MaxConnLifetime)) + config, err := pgxpool.ParseConfig(fmt.Sprintf("postgres://%s:%s@%s:%s/%s?pool_max_conns=%d&pool_max_conn_lifetime=%s", cfg.User, cfg.Password, cfg.Host, cfg.Port, cfg.Name, cfg.MaxConns, cfg.MaxConnLifetime)) if err != nil { log.Errorf("Unable to parse DB config: %v\n", err) return nil, err