Skip to content

Commit

Permalink
revert some code
Browse files Browse the repository at this point in the history
Signed-off-by: HunDunDM <hundundm@gmail.com>
  • Loading branch information
HunDunDM committed Jun 22, 2021
1 parent b96a1f6 commit 0a35608
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion server/region_syncer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
log.Error("cannot establish connection with leader", zap.String("server", s.server.Name()), zap.String("leader", s.server.GetLeader().GetName()), errs.ZapError(err))
continue
}
defer conn.Close()
break
}
defer conn.Close()

// Start syncing data.
for {
Expand Down
7 changes: 2 additions & 5 deletions server/region_syncer/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ func (s *RegionSyncer) RunServer(ctx context.Context, regionNotifier <-chan *cor
return
case first := <-regionNotifier:
requests = append(requests, first.GetMeta())
stats = append(stats, first.GetStat())
leaders = append(leaders, first.GetLeader())
stats := append(stats, first.GetStat())
leaders := append(leaders, first.GetLeader())
startIndex := s.history.GetNextIndex()
s.history.Record(first)
pending := len(regionNotifier)
Expand All @@ -143,8 +143,6 @@ func (s *RegionSyncer) RunServer(ctx context.Context, regionNotifier <-chan *cor
s.broadcast(alive)
}
requests = requests[:0]
stats = stats[:0]
leaders = leaders[:0]
}
}

Expand Down Expand Up @@ -233,7 +231,6 @@ func (s *RegionSyncer) syncHistoryRegion(ctx context.Context, request *pdpb.Sync
lastIndex += len(metas)
if err := stream.Send(resp); err != nil {
log.Error("failed to send sync region response", errs.ZapError(errs.ErrGRPCSend, err))
return err
}
metas = metas[:0]
stats = stats[:0]
Expand Down

0 comments on commit 0a35608

Please sign in to comment.