瀏覽代碼

fix: 修复redis连接池

lijian 2 年之前
父節點
當前提交
4a7a88e09f
共有 2 個文件被更改,包括 8 次插入6 次删除
  1. 4 3
      pkg/online/online.go
  2. 4 3
      pkg/token/token.go

+ 4 - 3
pkg/online/online.go

@@ -22,9 +22,10 @@ type Manager struct {
 
 func NewManager(host string, port, db int) *Manager {
 	gredis.SetConfig(gredis.Config{
-		Host: host,
-		Port: port,
-		Db:   db,
+		Host:      host,
+		Port:      port,
+		Db:        db,
+		MaxActive: 100,
 	})
 	mgr := &Manager{
 		redisClient: gredis.Instance(),

+ 4 - 3
pkg/token/token.go

@@ -20,9 +20,10 @@ type Helper struct {
 
 func NewHelper(host string, port, db int) *Helper {
 	gredis.SetConfig(gredis.Config{
-		Host: host,
-		Port: port,
-		Db:   db,
+		Host:      host,
+		Port:      port,
+		Db:        db,
+		MaxActive: 100,
 	})
 	helper := &Helper{
 		redisClient: gredis.Instance(),