From 92a97d77eb541ce499e613a50abe151242fac793 Mon Sep 17 00:00:00 2001 From: taoshihan <630892807@qq.com> Date: Sun, 5 Jun 2022 22:25:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/models.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/models/models.go b/models/models.go index a5f8994..ce639e1 100644 --- a/models/models.go +++ b/models/models.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/jinzhu/gorm" "github.com/taoshihan1991/imaptool/common" - "github.com/taoshihan1991/imaptool/tools" "log" "time" ) @@ -28,15 +27,14 @@ func Connect() error { DB, err = gorm.Open("mysql", dsn) if err != nil { log.Println(err) - tools.Logger().Println(err) + panic("数据库连接失败!") return err - //panic("数据库连接失败!") } DB.SingularTable(true) DB.LogMode(true) - DB.SetLogger(tools.Logger()) DB.DB().SetMaxIdleConns(10) DB.DB().SetMaxOpenConns(100) + DB.DB().SetConnMaxLifetime(59 * time.Second) InitConfig() return nil }