fix (sync): concurrent map read and map write

This commit is contained in:
Mickael Kerjean 2022-09-08 14:55:26 +10:00
parent bfe809d5ab
commit bb7ea98f02

View file

@ -86,9 +86,9 @@ func NewKeyValueStore() KeyValueStore {
func (this *KeyValueStore) Get(key string) interface{} {
var val interface{}
this.RLock()
this.Lock()
val = this.cache[key]
this.RUnlock()
this.Unlock()
return val
}