From 746ec6be907185b408291eab4192aa5175e71911 Mon Sep 17 00:00:00 2001 From: kzkzzzz Date: Wed, 24 May 2023 21:48:23 +0800 Subject: [PATCH] update --- myredis/redis.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/myredis/redis.go b/myredis/redis.go index dabca16..126e902 100644 --- a/myredis/redis.go +++ b/myredis/redis.go @@ -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)