From a17dd11ce63283dbbace389ebafa219950c94de6 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 15 Apr 2019 13:09:44 +1000 Subject: [PATCH] fix (cache): fix concurrency issue where our mutex wasn't lock properly --- server/common/cache.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/common/cache.go b/server/common/cache.go index d3bd33bf..029ebec4 100644 --- a/server/common/cache.go +++ b/server/common/cache.go @@ -86,7 +86,7 @@ func NewKeyValueStore() KeyValueStore { return KeyValueStore{ cache: make(map[string]interface{}) } } -func (this KeyValueStore) Get(key string) interface{} { +func (this *KeyValueStore) Get(key string) interface{} { this.Lock() val := this.cache[key] this.Unlock() @@ -101,6 +101,6 @@ func (this *KeyValueStore) Set(key string, value interface{}) { func (this *KeyValueStore) Clear() { this.Lock() - defer this.Unlock() this.cache = make(map[string]interface{}) + this.Unlock() }