fixes the broken pipe connection error with postgres. Similar as PR: #4719 (#15211) (#15559)

Signed-off-by: Vadim Bauer <vb@container-registry.com>
Signed-off-by: He Weiwei <hweiwei@vmware.com>

Co-authored-by: Vadim Bauer <1492007+Vad1mo@users.noreply.github.com>
This commit is contained in:
He Weiwei 2021-09-09 14:13:18 +08:00 committed by GitHub
parent 74ecf354cd
commit 6931d733f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,7 @@ import (
"net/url"
"os"
"strconv"
"time"
"github.com/astaxie/beego/orm"
"github.com/goharbor/harbor/src/common/models"
@ -97,6 +98,7 @@ func (p *pgsql) Register(alias ...string) error {
// and https://github.com/astaxie/beego/issues/4059 for more info.
db, _ := orm.GetDB(an)
db.SetMaxOpenConns(p.maxOpenConns)
db.SetConnMaxLifetime(5 * time.Minute)
return nil
}