From 6931d733f26a37965e369011d8f912b5c3dd2245 Mon Sep 17 00:00:00 2001 From: He Weiwei Date: Thu, 9 Sep 2021 14:13:18 +0800 Subject: [PATCH] fixes the broken pipe connection error with postgres. Similar as PR: #4719 (#15211) (#15559) Signed-off-by: Vadim Bauer Signed-off-by: He Weiwei Co-authored-by: Vadim Bauer <1492007+Vad1mo@users.noreply.github.com> --- src/common/dao/pgsql.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/dao/pgsql.go b/src/common/dao/pgsql.go index a49d83314..5cf6bfeb5 100644 --- a/src/common/dao/pgsql.go +++ b/src/common/dao/pgsql.go @@ -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 }