mirror of https://github.com/kubernetes/kops.git
Merge pull request #6707 from justinsb/fix_6635
Deep-copy proto state to prevent concurrent modification
This commit is contained in:
commit
33128e5fc4
|
|
@ -159,10 +159,19 @@ func (s *state) merge(message *KVState, changes *KVState) {
|
|||
s.mtx.Lock()
|
||||
defer s.mtx.Unlock()
|
||||
|
||||
changed := mergeKVState(&s.data, message, changes)
|
||||
var c KVState
|
||||
if s.data.Records != nil {
|
||||
c.Records = make(map[string]*KVStateRecord)
|
||||
for k, v := range s.data.Records {
|
||||
c.Records[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
changed := mergeKVState(&c, message, changes)
|
||||
|
||||
if changed {
|
||||
s.version++
|
||||
s.data = c
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue