Fix raft paralle retry bug (#14303)

This commit is contained in:
Pratyoy Mukhopadhyay 2022-02-28 10:38:34 -08:00 committed by GitHub
parent 0b31c4a404
commit 69c22b8078
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -961,17 +961,17 @@ func (c *Core) JoinRaftCluster(ctx context.Context, leaderInfos []*raft.LeaderJo
return err
}
var wg sync.WaitGroup
for i := range leaderInfos {
for i := range expandedJoinInfos {
wg.Add(1)
go func(joinInfo *raft.LeaderJoinInfo) {
defer wg.Done()
raftInfo, err := c.getRaftChallenge(joinInfo)
if err != nil {
c.Logger().Trace("failed to get raft challenge", "leader_addr", joinInfo.LeaderAPIAddr, "error", err)
c.Logger().Error("failed to get raft challenge", "leader_addr", joinInfo.LeaderAPIAddr, "error", err)
return
}
challengeCh <- raftInfo
}(leaderInfos[i])
}(expandedJoinInfos[i])
}
go func() {
wg.Wait()