mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
in GuaranteedUpdate, retry on precondition check failure if we are working with cached data
This commit is contained in:
parent
2670651a3c
commit
88f0be6e59
@ -274,7 +274,20 @@ func (s *store) GuaranteedUpdate(
|
|||||||
transformContext := authenticatedDataString(key)
|
transformContext := authenticatedDataString(key)
|
||||||
for {
|
for {
|
||||||
if err := preconditions.Check(key, origState.obj); err != nil {
|
if err := preconditions.Check(key, origState.obj); err != nil {
|
||||||
return err
|
// If our data is already up to date, return the error
|
||||||
|
if !mustCheckData {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// It's possible we were working with stale data
|
||||||
|
// Actually fetch
|
||||||
|
origState, err = getCurrentState()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mustCheckData = false
|
||||||
|
// Retry
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
ret, ttl, err := s.updateState(origState, tryUpdate)
|
ret, ttl, err := s.updateState(origState, tryUpdate)
|
||||||
|
Loading…
Reference in New Issue
Block a user