🔨 Rename WaitForFinish method to WaitForTermination

This commit is contained in:
M. Mert Yildiran 2022-12-27 09:28:23 +03:00
parent 11a2f93e34
commit 33f23ea849
No known key found for this signature in database
GPG Key ID: DA5D6DCBB758A461
6 changed files with 7 additions and 7 deletions

View File

@ -238,7 +238,7 @@ func pcap() {
ctxC, cancel := context.WithCancel(context.Background()) ctxC, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
utils.WaitForFinish(ctxC, cancel) utils.WaitForTermination(ctxC, cancel)
err = stopAndRemoveContainers(ctx, cli, respFront, respHub, respWorker) err = stopAndRemoveContainers(ctx, cli, respFront, respHub, respWorker)
if err != nil { if err != nil {

View File

@ -64,7 +64,7 @@ func runProxy() {
okToOpen(url) okToOpen(url)
utils.WaitForFinish(ctx, cancel) utils.WaitForTermination(ctx, cancel)
} }
func okToOpen(url string) { func okToOpen(url string) {

View File

@ -100,7 +100,7 @@ func tap() {
go goUtils.HandleExcWrapper(watchFrontPod, ctx, kubernetesProvider, cancel) go goUtils.HandleExcWrapper(watchFrontPod, ctx, kubernetesProvider, cancel)
// block until exit signal or error // block until exit signal or error
utils.WaitForFinish(ctx, cancel) utils.WaitForTermination(ctx, cancel)
} }
func finishTapExecution(kubernetesProvider *kubernetes.Provider) { func finishTapExecution(kubernetesProvider *kubernetes.Provider) {

View File

@ -80,7 +80,7 @@ func (connector *Connector) PostWorkerPodToHub(pod *v1.Pod) {
ok = true ok = true
log.Debug().Interface("worker-pod", pod).Msg("Reported worker pod to Hub:") 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 ok = true
log.Debug().Int("pod-count", len(pods)).Msg("Reported targetted pods to Hub:") log.Debug().Int("pod-count", len(pods)).Msg("Reported targetted pods to Hub:")
} }
time.Sleep(1 * time.Second) time.Sleep(time.Second)
} }
} }
} }

View File

@ -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) { 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. // Call cancel if a terminating signal was received. Allows user to skip the wait.
go func() { go func() {
utils.WaitForFinish(ctx, cancel) utils.WaitForTermination(ctx, cancel)
}() }()
if err := kubernetesProvider.WaitUtilNamespaceDeleted(ctx, kubesharkResourcesNamespace); err != nil { if err := kubernetesProvider.WaitUtilNamespaceDeleted(ctx, kubesharkResourcesNamespace); err != nil {

View File

@ -9,7 +9,7 @@ import (
"github.com/rs/zerolog/log" "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...") log.Debug().Msg("Waiting to finish...")
sigChan := make(chan os.Signal, 1) sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)