mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #106153 from hyschumi/refactor_thread_safe_store
refactor: remove dup code
This commit is contained in:
commit
e9fc46750f
@ -71,11 +71,7 @@ type threadSafeMap struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *threadSafeMap) Add(key string, obj interface{}) {
|
func (c *threadSafeMap) Add(key string, obj interface{}) {
|
||||||
c.lock.Lock()
|
c.Update(key, obj)
|
||||||
defer c.lock.Unlock()
|
|
||||||
oldObject := c.items[key]
|
|
||||||
c.items[key] = obj
|
|
||||||
c.updateIndices(oldObject, obj, key)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *threadSafeMap) Update(key string, obj interface{}) {
|
func (c *threadSafeMap) Update(key string, obj interface{}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user