fix divide by zero bug
This commit is contained in:
parent
d3140c0fc2
commit
a89d1edc41
@ -560,11 +560,6 @@ func (h *httpBroker) Publish(topic string, msg *Message, opts ...PublishOption)
|
||||
|
||||
srv := func(s []*registry.Service, b []byte) {
|
||||
for _, service := range s {
|
||||
// only process if we have nodes
|
||||
if len(service.Nodes) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
var nodes []*registry.Node
|
||||
|
||||
for _, node := range service.Nodes {
|
||||
@ -581,6 +576,11 @@ func (h *httpBroker) Publish(topic string, msg *Message, opts ...PublishOption)
|
||||
nodes = append(nodes, node)
|
||||
}
|
||||
|
||||
// only process if we have nodes
|
||||
if len(nodes) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
switch service.Version {
|
||||
// broadcast version means broadcast to all nodes
|
||||
case broadcastVersion:
|
||||
|
Loading…
x
Reference in New Issue
Block a user