mirror of https://github.com/openkruise/kruise.git
Merge pull request #401 from FillZpp/fix-resource-version-expectation
Fix resourceVersionExpectation lock
This commit is contained in:
commit
df6a76a4c1
|
|
@ -36,7 +36,7 @@ func NewResourceVersionExpectation() ResourceVersionExpectation {
|
|||
}
|
||||
|
||||
type realResourceVersionExpectation struct {
|
||||
sync.RWMutex
|
||||
sync.Mutex
|
||||
objectVersions map[types.UID]string
|
||||
}
|
||||
|
||||
|
|
@ -57,8 +57,8 @@ func (r *realResourceVersionExpectation) Observe(obj metav1.Object) {
|
|||
}
|
||||
|
||||
func (r *realResourceVersionExpectation) IsSatisfied(obj metav1.Object) bool {
|
||||
r.RLock()
|
||||
defer r.RUnlock()
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
if isResourceVersionNewer(r.objectVersions[obj.GetUID()], obj.GetResourceVersion()) {
|
||||
delete(r.objectVersions, obj.GetUID())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func NewScaleExpectations() ScaleExpectations {
|
|||
}
|
||||
|
||||
type realScaleExpectations struct {
|
||||
sync.RWMutex
|
||||
sync.Mutex
|
||||
// key: parent key, workload namespace/name
|
||||
controllerCache map[string]*realControllerScaleExpectations
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ func NewUpdateExpectations(getRevision func(metav1.Object) string) UpdateExpecta
|
|||
}
|
||||
|
||||
type realUpdateExpectations struct {
|
||||
sync.RWMutex
|
||||
sync.Mutex
|
||||
// key: parent key, workload namespace/name
|
||||
controllerCache map[string]*realControllerUpdateExpectations
|
||||
// how to get pod revision
|
||||
|
|
|
|||
Loading…
Reference in New Issue