Commit 425bae0c authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #37468 from…

Merge pull request #37468 from bruceauyeung/k8s-branch-rename-constant-MaxPatchConflicts-to-maxRetryWhenPatchConflicts Automatic merge from submit-queue (batch tested with PRs 37468, 36546, 38713, 38902, 38614) rename constant MaxPatchConflicts to maxRetryWhenPatchConflicts **What this PR does / why we need it**: 1. literally `MaxPatchConflicts` means max number of patch conflicts allowed during a patch operation. but actually in codes it is used to indicate max number of patch retry when patch conflicts happened. 2. there is no need to export this constant because it is only used in `resthandler.go` and shouldn't be used in other packages. Signed-off-by: 's avatarbruceauyeung <ouyang.qinhua@zte.com.cn>
parents 699964c9 bc43e491
...@@ -93,8 +93,8 @@ func (scope *RequestScope) err(err error, w http.ResponseWriter, req *http.Reque ...@@ -93,8 +93,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 api.Context, name string, req *restful.Request) (runtime.Object, error) type getterFunc func(ctx api.Context, name string, req *restful.Request) (runtime.Object, error)
// MaxPatchConflicts is the maximum number of conflicts retry for during a patch operation before returning failure // maxRetryWhenPatchConflicts is the maximum number of conflicts retry during a patch operation before returning failure
const MaxPatchConflicts = 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.
...@@ -648,7 +648,7 @@ func patchResource( ...@@ -648,7 +648,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 < MaxPatchConflicts && (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)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment