提交 1a5f7881 编写于 作者: P Piotr Bryk

Merge pull request #91 from zreigz/bug_fix_wait_for_cluster

Bug fix. Prevent for double call isRunning() function
......@@ -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();
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册