From 455bc4439d9f20b9b8f09f931f52231b388b13fa Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 8 Apr 2019 09:10:14 +0200 Subject: [PATCH 1/2] Only check shard sync status for cluster deployments. This fixes a test and is benficial otherwise, too. --- pkg/deployment/resources/deployment_health.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/deployment/resources/deployment_health.go b/pkg/deployment/resources/deployment_health.go index 8bf39cf71..e82e04aaa 100644 --- a/pkg/deployment/resources/deployment_health.go +++ b/pkg/deployment/resources/deployment_health.go @@ -180,5 +180,9 @@ dbloop: func (r *Resources) GetShardSyncStatus() bool { r.shardSync.mutex.Lock() defer r.shardSync.mutex.Unlock() + if r.context.GetSpec().GetMode() != api.DeploymentModeCluster { + // Shard sync status is only applicable for clusters + return true + } return r.shardSync.allInSync } From 147a0d6953b61c461f2360783cffddc6141d4f46 Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 8 Apr 2019 09:26:45 +0200 Subject: [PATCH 2/2] Hold Mutex for shorter or not at all if not needed. --- pkg/deployment/resources/deployment_health.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/deployment/resources/deployment_health.go b/pkg/deployment/resources/deployment_health.go index e82e04aaa..ec95761c5 100644 --- a/pkg/deployment/resources/deployment_health.go +++ b/pkg/deployment/resources/deployment_health.go @@ -178,11 +178,11 @@ dbloop: // GetShardSyncStatus returns true if all shards are in sync func (r *Resources) GetShardSyncStatus() bool { - r.shardSync.mutex.Lock() - defer r.shardSync.mutex.Unlock() if r.context.GetSpec().GetMode() != api.DeploymentModeCluster { // Shard sync status is only applicable for clusters return true } + r.shardSync.mutex.Lock() + defer r.shardSync.mutex.Unlock() return r.shardSync.allInSync }