diff --git a/build/cluster.js b/build/cluster.js index 911535697c1b5e76cd55d7edb19fd1d88dd690d4..5d5c580e60715fe1c139575c36e41298139d451e 100644 --- a/build/cluster.js +++ b/build/cluster.js @@ -47,6 +47,15 @@ let clusterProcess = null; let exec = childProcess.exec; +/** + * A Number, representing the ID value of the timer that is set for function which periodically + * checks if cluster is running. The null means that no timer is running. + * + * @type {?number} + */ +let isRunningSetIntervalHandler = null; + + /** * Checks if cluster health check return correct status. * When custer is up and running then return 'ok'. @@ -188,14 +197,17 @@ gulp.task('spawn-cluster', ['checkout-kubernetes-version', 'kubeconfig-set-clust * Checks periodically if cluster is up and running. */ gulp.task('wait-for-cluster', function (doneFn) { - let isRunningHandler = setInterval(isRunning, 1000); + if(!isRunningSetIntervalHandler) { + isRunningSetIntervalHandler = setInterval(isRunning, 1000); + } function isRunning() { clusterHealthCheck(function (result) { if (result === 'ok') { gulpUtil.log( gulpUtil.colors.magenta("Kubernetes cluster is up and running.")); - clearTimeout(isRunningHandler); + clearTimeout(isRunningSetIntervalHandler); + isRunningSetIntervalHandler = null; doneFn(); } });