fix goroutine race condition

This commit is contained in:
Derek Perkins 2020-06-19 23:41:42 -06:00 committed by GitHub
parent ba255c644a
commit 3f29740e18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,10 +265,10 @@ func (g *Group) Remove(ctx context.Context, key string) error {
} }
wg.Add(1) wg.Add(1)
go func() { go func(peer string) {
errs <- g.removeFromPeer(ctx, peer, key) errs <- g.removeFromPeer(ctx, peer, key)
wg.Done() wg.Done()
}() }(peer)
} }
go func() { go func() {
wg.Wait() wg.Wait()