From 22b1208a20b58ced6ddad8ace0b5f69e8d1579a8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 15 Mar 2022 11:30:30 +0300 Subject: [PATCH] [#1236] neofs-node: Remove mutex from `lruNetCache` We already use thread-safe LRU and mutex shouldn't be taken while making network requests. Signed-off-by: Evgenii Stratonikov --- cmd/neofs-node/cache.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/neofs-node/cache.go b/cmd/neofs-node/cache.go index bd49f55109..bf87a7b0af 100644 --- a/cmd/neofs-node/cache.go +++ b/cmd/neofs-node/cache.go @@ -98,14 +98,12 @@ func (c *ttlNetCache) keys() []interface{} { // entity that provides LRU cache interface. type lruNetCache struct { - mtx sync.Mutex - cache *lru.Cache netRdr netValueReader } -// complicates netValueReader with LRU caching mechanism. +// newNetworkLRUCache returns wrapper over netValueReader with LRU cache. func newNetworkLRUCache(sz int, netRdr netValueReader) *lruNetCache { cache, err := lru.New(sz) fatalOnErr(err) @@ -122,9 +120,6 @@ func newNetworkLRUCache(sz int, netRdr netValueReader) *lruNetCache { // // returned value should not be modified. func (c *lruNetCache) get(key interface{}) (interface{}, error) { - c.mtx.Lock() - defer c.mtx.Unlock() - val, ok := c.cache.Get(key) if ok { return val, nil