Skip to content

Commit 1ca3435

Browse files
committed
Check ReadyToUse in sidecar
1 parent 8179759 commit 1ca3435

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/sidecar-controller/snapshot_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ func (ctrl *csiSnapshotSideCarController) syncContent(content *crdv1.VolumeSnaps
8080
return err
8181
}
8282
} else {
83+
// Skip checkandUpdateContentStatus() if ReadyToUse is
84+
// already true. We don't want to keep calling CreateSnapshot
85+
// or ListSnapshots CSI methods over and over again for
86+
// performance reasons.
87+
if content.Status != nil && content.Status.ReadyToUse != nil && *content.Status.ReadyToUse == true {
88+
return nil
89+
}
8390
if err = ctrl.checkandUpdateContentStatus(content); err != nil {
8491
ctrl.updateContentErrorStatusWithEvent(content, v1.EventTypeWarning, "SnapshotContentStatusUpdateFailed", fmt.Sprintf("Failed to update snapshot content status with error %v", err))
8592
return err

0 commit comments

Comments
 (0)