Alerting: Support for optimistic locking for alert rules (#50274)

* add support for optimistic locking for alert_rule table
* return 409 in the case of opitimistic lock
This commit is contained in:
Yuriy Tseretyan
2022-06-13 12:15:28 -04:00
committed by GitHub
parent 402b5ce4c6
commit c314ce48c7
6 changed files with 117 additions and 10 deletions
+2
View File
@@ -467,6 +467,8 @@ func (srv RulerSrv) updateAlertRulesInGroup(c *models.ReqContext, groupKey ngmod
return ErrResp(http.StatusForbidden, err, "")
} else if errors.Is(err, ErrAuthorization) {
return ErrResp(http.StatusUnauthorized, err, "")
} else if errors.Is(err, store.ErrOptimisticLock) {
return ErrResp(http.StatusConflict, err, "")
}
return ErrResp(http.StatusInternalServerError, err, "failed to update rule group")
}