1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 13:23:07 +01:00

perf: introduces a timeout when fetching host info (#3276)

This commit is contained in:
Amir Raminfar
2024-09-20 09:19:08 -07:00
committed by GitHub
parent 03fdd82db6
commit 92614ea63c
27 changed files with 213 additions and 178 deletions

View File

@@ -103,7 +103,9 @@ func main() {
if err != nil {
log.Fatal().Err(err).Msg("Could not read certificates")
}
if err := healthcheck.RPCRequest(agentAddress, certs); err != nil {
ctx, cancel := context.WithTimeout(context.Background(), args.Timeout)
defer cancel()
if err := healthcheck.RPCRequest(ctx, agentAddress, certs); err != nil {
log.Fatal().Err(err).Msg("Failed to make request")
}
}
@@ -155,8 +157,8 @@ func main() {
if err != nil {
log.Fatal().Err(err).Msg("Could not read certificates")
}
manager := docker_support.NewSwarmClientManager(localClient, certs)
multiHostService = docker_support.NewMultiHostService(manager)
manager := docker_support.NewSwarmClientManager(localClient, certs, args.Timeout)
multiHostService = docker_support.NewMultiHostService(manager, args.Timeout)
log.Info().Msg("Starting in swarm mode")
listener, err := net.Listen("tcp", ":7007")
if err != nil {