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

Signed-off-by: Vadim Bauer <vb@container-registry.com>

Co-authored-by: Vadim Bauer <vb@container-registry.com>
This commit is contained in:
Vadim Bauer 2021-07-23 08:56:54 +02:00 committed by GitHub
parent e5a614967d
commit 13d5e4a7de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ import (
"net/url"
"os"
"strconv"
"time"
"github.com/astaxie/beego/orm"
"github.com/goharbor/harbor/src/common/utils"
@ -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
}