nats-io / nats-server

High-Performance server for NATS.io, the cloud and edge native messaging system.
https://nats.io
Apache License 2.0
16.03k stars 1.41k forks source link

[FIXED] Cluster: load balancing of queue groups from attached leaf nodes #6043

Closed kozlovic closed 1 month ago

kozlovic commented 1 month ago

When receiving a message from a route, if the queue interest is only routes and leaf connections, the server will always favor the leaf kind. However, if there were more than one leaf connections for the same queue group, the server will always pick the same (the last one). It would change if new leaf were to connect or disconnect/reconnect, but with a stable set, it would always be the same.

This PR makes this selection somewhat random.

Resolves #6040

Signed-off-by: Ivan Kozlovic ivan@synadia.com