From 2a5e71abfa60ac4ea9b55f067406d20283145c2b Mon Sep 17 00:00:00 2001 From: "Richard T. Carback III" <rick.carback@gmail.com> Date: Tue, 16 Mar 2021 20:20:38 +0000 Subject: [PATCH] Move timeout timer creation to inside the for loop, so it is reset each time instead of acting as a program runtime timeout --- cmd/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index fb1efae75..b025af41c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -197,9 +197,9 @@ var rootCmd = &cobra.Command{ receiveCnt := uint(0) waitSecs := viper.GetUint("waitTimeout") waitTimeout := time.Duration(waitSecs) - timeoutTimer := time.NewTimer(waitTimeout * time.Second) done := false for !done && expectedCnt != 0 { + timeoutTimer := time.NewTimer(waitTimeout * time.Second) select { case <-timeoutTimer.C: fmt.Println("Timed out!") -- GitLab