Skip to content

Commit

Permalink
fix race
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <[email protected]>
  • Loading branch information
nolouch committed Apr 15, 2024
1 parent 13c66bc commit d85ac59
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/core/region.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,18 +720,17 @@ 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.
return func(ctx *MetaProcessContext, region, origin *RegionInfo) (saveKV, saveCache, needSync bool) {
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(
Expand Down

0 comments on commit d85ac59

Please sign in to comment.