Skip to content

Commit 147a0d6

Browse files
committed
Hold Mutex for shorter or not at all if not needed.
1 parent 455bc44 commit 147a0d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/deployment/resources/deployment_health.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ dbloop:
178178

179179
// GetShardSyncStatus returns true if all shards are in sync
180180
func (r *Resources) GetShardSyncStatus() bool {
181-
r.shardSync.mutex.Lock()
182-
defer r.shardSync.mutex.Unlock()
183181
if r.context.GetSpec().GetMode() != api.DeploymentModeCluster {
184182
// Shard sync status is only applicable for clusters
185183
return true
186184
}
185+
r.shardSync.mutex.Lock()
186+
defer r.shardSync.mutex.Unlock()
187187
return r.shardSync.allInSync
188188
}

0 commit comments

Comments
 (0)