refactor same node URI check in SendSync

This commit is contained in:
Michael Baird 2017-11-30 22:03:24 -06:00 • committed by Travis Turner
parent 04790f70f2
commit 21072a665f
No known key found for this signature in database
GPG key ID: 7F08008DFD9314C9

View file

@ -345,13 +345,15 @@ func (s *Server) SendSync(pb proto.Message) error {
return err
}
// Don't forward the message to ourselves
if *s.URI != *uri {
ctx := context.WithValue(context.Background(), "uri", uri)
eg.Go(func() error {
return s.defaultClient.ClusterMessage(ctx, pb)
})
// Don't forward the message to ourselves.
if *s.URI == *uri {
continue
}
ctx := context.WithValue(context.Background(), "uri", uri)
eg.Go(func() error {
return s.defaultClient.ClusterMessage(ctx, pb)
})
}
return eg.Wait()