Skip to content

Commit

Permalink
fixes icon bug
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 committed Nov 15, 2024
1 parent bcb7e4c commit 1675ccb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 5 additions & 6 deletions internal/support/docker/swarm_client_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,11 @@ func (m *SwarmClientManager) Find(id string) (ClientService, bool) {
}

func (m *SwarmClientManager) Hosts(ctx context.Context) []docker.Host {
clients := m.List()
m.mu.RLock()
clients := lo.Values(m.clients)
m.mu.RUnlock()

hosts := lop.Map(clients, func(client ClientService, _ int) docker.Host {
swarmNodes := lop.Map(clients, func(client ClientService, _ int) docker.Host {
host, err := client.Host(ctx)
if err != nil {
log.Warn().Err(err).Str("id", host.ID).Msg("error getting host from client")
Expand All @@ -221,10 +223,7 @@ func (m *SwarmClientManager) Hosts(ctx context.Context) []docker.Host {
return host
})

agents := m.agentManager.Hosts(ctx)

return append(agents, hosts...)

return append(m.agentManager.Hosts(ctx), swarmNodes...)
}

func (m *SwarmClientManager) String() string {
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ func main() {
log.Info().Str("endpoint", args.AgentTest.Address).Msg("Connecting to agent")

agent, err := agent.NewClient(args.AgentTest.Address, certs)
if err != nil {
log.Fatal().Err(err).Str("endpoint", args.AgentTest.Address).Msg("error connecting to agent")
}
ctx, cancel := context.WithTimeout(context.Background(), args.Timeout)
defer cancel()
host, err := agent.Host(ctx)
Expand Down

0 comments on commit 1675ccb

Please sign in to comment.