🐛 尝试增加redis超时时间
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"likedream-goframe/internal/cst"
|
||||
"likedream-goframe/internal/utils"
|
||||
"time"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/redis/go-redis/v9"
|
||||
@@ -25,6 +26,9 @@ func Init(ctx context.Context) {
|
||||
redisUrl := g.Cfg().MustGetWithEnv(ctx, cst.ConfigRedisUrl).String()
|
||||
|
||||
redisOpts, e := redis.ParseURL(redisUrl)
|
||||
redisOpts.DialTimeout = 30 * time.Second
|
||||
redisOpts.ReadTimeout = 30 * time.Second
|
||||
redisOpts.WriteTimeout = 30 * time.Second
|
||||
utils.OkOrPanic(e, oops.WithContext(ctx).
|
||||
With("redisUrl", redisUrl).
|
||||
Wrap)
|
||||
|
||||
Reference in New Issue
Block a user