we need to not return after processing broadcast, still gotta process the other queues
This commit is contained in:
parent
0be3256d25
commit
8873e6ad08
@ -375,19 +375,27 @@ func (h *httpBroker) Publish(topic string, msg *Message, opts ...PublishOption)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, service := range s {
|
for _, service := range s {
|
||||||
|
// only process if we have nodes
|
||||||
|
if len(service.Nodes) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
switch service.Version {
|
||||||
// broadcast version means broadcast to all nodes
|
// broadcast version means broadcast to all nodes
|
||||||
if service.Version == broadcastVersion {
|
case broadcastVersion:
|
||||||
for _, node := range service.Nodes {
|
for _, node := range service.Nodes {
|
||||||
// publish async
|
// publish async
|
||||||
go fn(node, b)
|
go fn(node, b)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
// select node to publish to
|
||||||
node := service.Nodes[rand.Int()%len(service.Nodes)]
|
node := service.Nodes[rand.Int()%len(service.Nodes)]
|
||||||
|
|
||||||
// publish async
|
// publish async
|
||||||
go fn(node, b)
|
go fn(node, b)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user