From f8fde36e1417f8429dd992b72d3711f93aadecaa Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 4 Dec 2024 11:26:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20redis=20GetHashBatch=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E6=98=AF=E5=90=A6=E8=B6=8A=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/redis/redis.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/framework/redis/redis.go b/src/framework/redis/redis.go index eb361217..04901497 100644 --- a/src/framework/redis/redis.go +++ b/src/framework/redis/redis.go @@ -277,6 +277,10 @@ func GetHashBatch(source string, keys []string) (map[string]map[string]string, e } for i := 0; i < total; i += batchSize { + // 检查索引是否越界 + if i+batchSize > total { + batchSize = total - i + } wg.Add(1) go func(start int) { ctx := context.Background()