diff --git a/cdc/kv/client.go b/cdc/kv/client.go index bfabe91fe9c..0541923ed6c 100644 --- a/cdc/kv/client.go +++ b/cdc/kv/client.go @@ -472,6 +472,7 @@ func (s *eventFeedSession) eventFeed(ctx context.Context) error { }() g, ctx := errgroup.WithContext(ctx) + g.SetLimit(scanRegionsConcurrency) g.Go(func() error { return s.dispatchRequest(ctx) }) @@ -480,8 +481,6 @@ func (s *eventFeedSession) eventFeed(ctx context.Context) error { g.Go(func() error { return s.logSlowRegions(ctx) }) g.Go(func() error { - g, ctx := errgroup.WithContext(ctx) - g.SetLimit(scanRegionsConcurrency) for { select { case <-ctx.Done():