mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Fix a race in the endpoint.go
This commit is contained in:
parent
572e276493
commit
cc4d2cbe9d
@ -164,7 +164,11 @@ func (e *endpointImpl) run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
e.mutex.Lock()
|
e.mutex.Lock()
|
||||||
e.devices = devices
|
// NOTE: Return a copy of 'devices' instead of returning a direct reference to local 'devices'
|
||||||
|
e.devices = make(map[string]pluginapi.Device)
|
||||||
|
for _, d := range devices {
|
||||||
|
e.devices[d.ID] = d
|
||||||
|
}
|
||||||
e.mutex.Unlock()
|
e.mutex.Unlock()
|
||||||
|
|
||||||
e.callback(e.resourceName, added, updated, deleted)
|
e.callback(e.resourceName, added, updated, deleted)
|
||||||
|
Loading…
Reference in New Issue
Block a user