From 0caed7a6dd2de05c64d71f287f01856e32cb235d Mon Sep 17 00:00:00 2001 From: Matthias Linhuber Date: Sat, 23 Sep 2023 23:35:37 +0200 Subject: [PATCH] Get rid of magic number --- HadesScheduler/kube/kube.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/HadesScheduler/kube/kube.go b/HadesScheduler/kube/kube.go index 9f256c2..f191ff7 100644 --- a/HadesScheduler/kube/kube.go +++ b/HadesScheduler/kube/kube.go @@ -19,6 +19,10 @@ import ( "k8s.io/client-go/tools/clientcmd" ) +const ( + waitForNamespace = 5 * time.Second +) + type JobScheduler interface { ScheduleJob(job payload.BuildJob) error } @@ -127,7 +131,7 @@ func createNamespace(clientset *kubernetes.Clientset, namespace string) (*corev1 } // sleep for 5 seconds to give the namespace time to be created - time.Sleep(5 * time.Second) + time.Sleep(waitForNamespace) return ns, nil }