@@ -54,6 +54,7 @@ func (r *Resources) RunDeploymentHealthLoop(stopCh <-chan struct{}) {
5454 deploymentHealthFetchesCounters .WithLabelValues (deploymentName , metrics .Success ).Inc ()
5555 }
5656 select {
57+ case <- r .shardSync .triggerSyncInspection .Done ():
5758 case <- time .After (time .Second * 5 ):
5859 // Continue
5960 case <- stopCh :
@@ -118,6 +119,15 @@ func (r *Resources) RunDeploymentShardSyncLoop(stopCh <-chan struct{}) {
118119 }
119120}
120121
122+ // InvalidateSyncStatus resets the sync state to false and triggers an inspection
123+ func (r * Resources ) InvalidateSyncStatus () {
124+ r .log .Debug ().Msg ("Invalidating sync status due to previous events" )
125+ r .shardSync .mutex .Lock ()
126+ defer r .shardSync .mutex .Unlock ()
127+ r .shardSync .allInSync = false
128+ r .shardSync .triggerSyncInspection .Trigger ()
129+ }
130+
121131// fetchClusterShardSyncState performs a single fetch of the cluster inventory and
122132// checks if all shards are in sync
123133func (r * Resources ) fetchClusterShardSyncState () error {
@@ -154,9 +164,15 @@ dbloop:
154164 }
155165
156166 r .shardSync .mutex .Lock ()
157- defer r .shardSync .mutex . Unlock ()
167+ oldSyncState := r .shardSync .allInSync
158168 r .shardSync .allInSync = allInSync
159169 r .shardSync .timestamp = time .Now ()
170+ r .shardSync .mutex .Unlock ()
171+
172+ if ! oldSyncState && allInSync {
173+ r .log .Debug ().Msg ("Everything is in sync by now" )
174+ }
175+
160176 return nil
161177}
162178
0 commit comments