mirror of https://github.com/k3s-io/k3s
k8s.io/apiserver: make maxRetryWhenPatchConflicts public
parent
8abb3ae7b2
commit
be6be1370b
|
@ -104,8 +104,8 @@ func (scope *RequestScope) err(err error, w http.ResponseWriter, req *http.Reque
|
||||||
// may be used to deserialize an options object to pass to the getter.
|
// may be used to deserialize an options object to pass to the getter.
|
||||||
type getterFunc func(ctx request.Context, name string, req *restful.Request) (runtime.Object, error)
|
type getterFunc func(ctx request.Context, name string, req *restful.Request) (runtime.Object, error)
|
||||||
|
|
||||||
// maxRetryWhenPatchConflicts is the maximum number of conflicts retry during a patch operation before returning failure
|
// MaxRetryWhenPatchConflicts is the maximum number of conflicts retry during a patch operation before returning failure
|
||||||
const maxRetryWhenPatchConflicts = 5
|
const MaxRetryWhenPatchConflicts = 5
|
||||||
|
|
||||||
// getResourceHandler is an HTTP handler function for get requests. It delegates to the
|
// getResourceHandler is an HTTP handler function for get requests. It delegates to the
|
||||||
// passed-in getterFunc to perform the actual get.
|
// passed-in getterFunc to perform the actual get.
|
||||||
|
@ -742,7 +742,7 @@ func patchResource(
|
||||||
|
|
||||||
return finishRequest(timeout, func() (runtime.Object, error) {
|
return finishRequest(timeout, func() (runtime.Object, error) {
|
||||||
updateObject, _, updateErr := patcher.Update(ctx, name, updatedObjectInfo)
|
updateObject, _, updateErr := patcher.Update(ctx, name, updatedObjectInfo)
|
||||||
for i := 0; i < maxRetryWhenPatchConflicts && (errors.IsConflict(updateErr)); i++ {
|
for i := 0; i < MaxRetryWhenPatchConflicts && (errors.IsConflict(updateErr)); i++ {
|
||||||
lastConflictErr = updateErr
|
lastConflictErr = updateErr
|
||||||
updateObject, _, updateErr = patcher.Update(ctx, name, updatedObjectInfo)
|
updateObject, _, updateErr = patcher.Update(ctx, name, updatedObjectInfo)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue