From d85ac5925b20064ac83f283b5403376d48b424bb Mon Sep 17 00:00:00 2001 From: nolouch Date: Mon, 15 Apr 2024 14:15:20 +0800 Subject: [PATCH] fix race Signed-off-by: nolouch --- pkg/core/region.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/core/region.go b/pkg/core/region.go index 469ea95157b..41bfb4d31ad 100644 --- a/pkg/core/region.go +++ b/pkg/core/region.go @@ -720,11 +720,9 @@ type RegionGuideFunc func(ctx *MetaProcessContext, region, origin *RegionInfo) ( func GenerateRegionGuideFunc(enableLog bool) RegionGuideFunc { noLog := func(string, ...zap.Field) {} d, i := noLog, noLog - debug, info := d, i if enableLog { d = log.Debug i = log.Info - debug, info = d, i } // Save to storage if meta is updated. // Save to cache if meta or leader is updated, or contains any down/pending peer. @@ -732,6 +730,7 @@ func GenerateRegionGuideFunc(enableLog bool) RegionGuideFunc { taskRunner := ctx.TaskRunner limiter := ctx.Limiter // print log asynchronously + debug, info := d, i if taskRunner != nil { debug = func(msg string, fields ...zap.Field) { taskRunner.RunTask(