The current agent.list_service_providers() function returns an unordered list of services matching some search criteria.
Proposed solution
Extend the function behavior to sort the results using a standard priority scheme:
- a service on the same node first
- a service on the leader node second
- a service on other worker nodes third
This ensures that list index 0 contains the nearest service instance in terms of VPN hops.
Alternative sort orderings may be implemented in the future; for this, an additional argument (e.g. sortby=) would be required.
Alternative solutions
Implement a separate function with the new behavior.
See also
The current
agent.list_service_providers()function returns an unordered list of services matching some search criteria.Proposed solution
Extend the function behavior to sort the results using a standard priority scheme:
This ensures that list index 0 contains the nearest service instance in terms of VPN hops.
Alternative sort orderings may be implemented in the future; for this, an additional argument (e.g.
sortby=) would be required.Alternative solutions
Implement a separate function with the new behavior.
See also