From 97eef47290f5289bbdf977d0412f5a046072e6ae Mon Sep 17 00:00:00 2001 From: Gabriel Mougard Date: Tue, 12 Dec 2023 19:21:47 +0100 Subject: [PATCH] microcloud/cmd: fix timeout issue In case of mDNS discovery issue (no IPv6 support on a node for example), the timeout never seems to occur leading to wait forever. This should fix the issue Signed-off-by: Gabriel Mougard --- microcloud/cmd/microcloud/main_init.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/microcloud/cmd/microcloud/main_init.go b/microcloud/cmd/microcloud/main_init.go index 673b72129..2b5b5b198 100644 --- a/microcloud/cmd/microcloud/main_init.go +++ b/microcloud/cmd/microcloud/main_init.go @@ -179,14 +179,12 @@ func lookupPeers(s *service.Handler, autoSetup bool, iface *net.Interface, subne }() } - var timeAfter <-chan time.Time + timeoutDuration := 1 * time.Minute if autoSetup { - timeAfter = time.After(5 * time.Second) + timeoutDuration = 5 * time.Second } - if len(expectedSystems) > 0 { - timeAfter = time.After(1 * time.Minute) - } + timeAfter := time.After(timeoutDuration) expectedSystemsMap := make(map[string]bool, len(expectedSystems)) for _, system := range expectedSystems {