main
kzkzzzz 2023-05-24 21:48:23 +08:00
parent 78557716f6
commit 746ec6be90
1 changed files with 2 additions and 2 deletions

View File

@ -109,10 +109,10 @@ func New(config *Config) (*MyRedis, error) {
MinIdleConns: config.MinIdleConn,
MaxConnAge: maxConnAge,
IdleTimeout: idleTimeout,
DialTimeout: time.Second * 2,
})
ctx := context.Background()
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
defer cancel()
rd := &MyRedis{}
rd.Client = client
ping := rd.Client.Ping(ctx)