mirror of https://github.com/k3s-io/k3s
Fix a race in the endpoint.go
parent
572e276493
commit
cc4d2cbe9d
|
@ -164,7 +164,11 @@ func (e *endpointImpl) run() {
|
|||
}
|
||||
|
||||
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.callback(e.resourceName, added, updated, deleted)
|
||||
|
|
Loading…
Reference in New Issue