sni / lmd

Livestatus Multitool Daemon - Create livestatus federation from multiple sources
https://labs.consol.de/omd/packages/lmd/
GNU General Public License v3.0
42 stars 31 forks source link

Keep services sorted after indexing #121

Closed erikdsjostrom closed 2 years ago

erikdsjostrom commented 2 years ago

When pre-filtering services by host name the services are fetched as map and then converted to an array. Since maps are an unordered data structure the order of the resulting array will essentially be random. This causes an issue with service queries which follow the default sort order, the result of these queries are not sorted because they are expected to already be sorted. So for a simple service query in the default sort order with a host_name filter which triggers pre-filtering this combination produces a result where the order of the services is random.

With this commit the services are sorted by their description, which is the default order, before returning them in the pre-filtering stage.

Signed-off-by: Erik Sjöström esjostrom@itrsgroup.com

erikdsjostrom commented 2 years ago

Now with new and improved array initializations.

sni commented 2 years ago

perfect, thanks a lot