controller: engine: Retry monitor refresh process if failed due to conflict
Longhorn
@@ -539,6 +539,7 @@ func (m *EngineMonitor) Run() {
}()
wait.Until(func() {
+ for {
engine, err := m.ds.GetEngine(m.Name)
if err != nil {
if datastore.ErrorIsNotFound(err) {
@@ -568,8 +569,11 @@ func (m *EngineMonitor) Run() {
return
}
- if err := m.refresh(engine); err != nil {
+ if err := m.refresh(engine); err == nil || !apierrors.IsConflict(errors.Cause(err)) {
utilruntime.HandleError(errors.Wrapf(err, "fail to update status for engine %v", m.Name))
+ break
+ }
+ // Retry if the error is due to conflict
}
}, EnginePollInterval, m.stopCh)
}
