Sort agents

This commit is contained in:
mudler
2024-04-17 12:42:49 +02:00
parent cac986d287
commit 96f7a4653f

View File

@@ -7,6 +7,7 @@ import (
"log/slog"
"os"
"path/filepath"
"sort"
"sync"
"time"
@@ -113,6 +114,10 @@ func (a *AgentPool) List() []string {
for agent := range a.pool {
agents = append(agents, agent)
}
// return a sorted list
sort.SliceStable(agents, func(i, j int) bool {
return agents[i] < agents[j]
})
return agents
}