[#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 <evgeniy@nspcc.ru>
(cherry picked from commit 22b1208a20)
This commit is contained in:
Evgenii Stratonikov 2022-03-15 11:30:30 +03:00 committed by Alex Vanin
parent 5f54fd5dc8
commit 73d367e287

View file

@ -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