Skip to content

Commit 10017c2

Browse files
committed
Add snapshot back to queue
1 parent 60c696c commit 10017c2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pkg/common-controller/snapshot_controller_base.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,12 @@ func (ctrl *csiSnapshotCommonController) snapshotWorker() {
207207
newSnapshot, err := ctrl.checkAndUpdateSnapshotClass(snapshot)
208208
if err == nil {
209209
klog.V(5).Infof("passed checkAndUpdateSnapshotClass for snapshot %q", key)
210-
ctrl.updateSnapshot(newSnapshot)
210+
err = ctrl.updateSnapshot(newSnapshot)
211+
}
212+
if err != nil {
213+
ctrl.snapshotQueue.AddRateLimited(key)
214+
return false
211215
}
212-
return false
213216
}
214217
if err != nil && !errors.IsNotFound(err) {
215218
klog.V(2).Infof("error getting snapshot %q from informer: %v", key, err)
@@ -340,7 +343,7 @@ func (ctrl *csiSnapshotCommonController) checkAndUpdateSnapshotClass(snapshot *c
340343

341344
// updateSnapshot runs in worker thread and handles "snapshot added",
342345
// "snapshot updated" and "periodic sync" events.
343-
func (ctrl *csiSnapshotCommonController) updateSnapshot(snapshot *crdv1.VolumeSnapshot) {
346+
func (ctrl *csiSnapshotCommonController) updateSnapshot(snapshot *crdv1.VolumeSnapshot) error {
344347
// Store the new snapshot version in the cache and do not process it if this is
345348
// an old version.
346349
klog.V(5).Infof("updateSnapshot %q", utils.SnapshotKey(snapshot))
@@ -349,7 +352,7 @@ func (ctrl *csiSnapshotCommonController) updateSnapshot(snapshot *crdv1.VolumeSn
349352
klog.Errorf("%v", err)
350353
}
351354
if !newSnapshot {
352-
return
355+
return nil
353356
}
354357
err = ctrl.syncSnapshot(snapshot)
355358
if err != nil {
@@ -359,8 +362,10 @@ func (ctrl *csiSnapshotCommonController) updateSnapshot(snapshot *crdv1.VolumeSn
359362
klog.V(3).Infof("could not sync claim %q: %+v", utils.SnapshotKey(snapshot), err)
360363
} else {
361364
klog.Errorf("could not sync volume %q: %+v", utils.SnapshotKey(snapshot), err)
365+
return err
362366
}
363367
}
368+
return nil
364369
}
365370

366371
// updateContent runs in worker thread and handles "content added",

0 commit comments

Comments
 (0)