diff --git a/cmd/pcapRunner.go b/cmd/pcapRunner.go index ab8286d84..9de17cf17 100644 --- a/cmd/pcapRunner.go +++ b/cmd/pcapRunner.go @@ -238,7 +238,7 @@ func pcap() { ctxC, cancel := context.WithCancel(context.Background()) defer cancel() - utils.WaitForFinish(ctxC, cancel) + utils.WaitForTermination(ctxC, cancel) err = stopAndRemoveContainers(ctx, cli, respFront, respHub, respWorker) if err != nil { diff --git a/cmd/proxyRunner.go b/cmd/proxyRunner.go index 7c261f435..d5133cc82 100644 --- a/cmd/proxyRunner.go +++ b/cmd/proxyRunner.go @@ -64,7 +64,7 @@ func runProxy() { okToOpen(url) - utils.WaitForFinish(ctx, cancel) + utils.WaitForTermination(ctx, cancel) } func okToOpen(url string) { diff --git a/cmd/tapRunner.go b/cmd/tapRunner.go index ae21f4b19..765a86400 100644 --- a/cmd/tapRunner.go +++ b/cmd/tapRunner.go @@ -100,7 +100,7 @@ func tap() { go goUtils.HandleExcWrapper(watchFrontPod, ctx, kubernetesProvider, cancel) // block until exit signal or error - utils.WaitForFinish(ctx, cancel) + utils.WaitForTermination(ctx, cancel) } func finishTapExecution(kubernetesProvider *kubernetes.Provider) { diff --git a/internal/connect/hub.go b/internal/connect/hub.go index 4507f049d..c7dc1ed3b 100644 --- a/internal/connect/hub.go +++ b/internal/connect/hub.go @@ -80,7 +80,7 @@ func (connector *Connector) PostWorkerPodToHub(pod *v1.Pod) { ok = true log.Debug().Interface("worker-pod", pod).Msg("Reported worker pod to Hub:") } - time.Sleep(1 * time.Second) + time.Sleep(time.Second) } } } @@ -102,7 +102,7 @@ func (connector *Connector) PostTargettedPodsToHub(pods []core.Pod) { ok = true log.Debug().Int("pod-count", len(pods)).Msg("Reported targetted pods to Hub:") } - time.Sleep(1 * time.Second) + time.Sleep(time.Second) } } } diff --git a/resources/cleanResources.go b/resources/cleanResources.go index b4daaca19..19db3cf77 100644 --- a/resources/cleanResources.go +++ b/resources/cleanResources.go @@ -71,7 +71,7 @@ func cleanUpNonRestrictedMode(ctx context.Context, cancel context.CancelFunc, ku func waitUntilNamespaceDeleted(ctx context.Context, cancel context.CancelFunc, kubernetesProvider *kubernetes.Provider, kubesharkResourcesNamespace string) { // Call cancel if a terminating signal was received. Allows user to skip the wait. go func() { - utils.WaitForFinish(ctx, cancel) + utils.WaitForTermination(ctx, cancel) }() if err := kubernetesProvider.WaitUtilNamespaceDeleted(ctx, kubesharkResourcesNamespace); err != nil { diff --git a/utils/wait.go b/utils/wait.go index 5346482b4..47de6bf56 100644 --- a/utils/wait.go +++ b/utils/wait.go @@ -9,7 +9,7 @@ import ( "github.com/rs/zerolog/log" ) -func WaitForFinish(ctx context.Context, cancel context.CancelFunc) { +func WaitForTermination(ctx context.Context, cancel context.CancelFunc) { log.Debug().Msg("Waiting to finish...") sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)