Skip to content

Commit

Permalink
Revert "db postgres add NewWithTimeout"
Browse files Browse the repository at this point in the history
This reverts commit 265b8ae.
  • Loading branch information
liaohengchen committed May 7, 2020
1 parent 265b8ae commit 08109c6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions db/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ func Get(dbAddr string) *bsql.DB {
}

func New(dbAddr string) *bsql.DB {
return NewWithTimeout(dbAddr, 5*time.Second)
}

func NewWithTimeout(dbAddr string, timeout time.Duration) *bsql.DB {
dbUrl := dburl.Parse(dbAddr)
db, err := sql.Open("postgres", dbUrl.URL.String())
if err != nil {
Expand All @@ -49,5 +45,5 @@ func NewWithTimeout(dbAddr string, timeout time.Duration) *bsql.DB {
db.SetMaxOpenConns(dbUrl.MaxOpen)
db.SetMaxIdleConns(dbUrl.MaxIdle)
db.SetConnMaxLifetime(dbUrl.MaxLife)
return bsql.New(db, timeout)
return bsql.New(db, 5*time.Second)
}

0 comments on commit 08109c6

Please sign in to comment.