Skip to content

Commit

Permalink
remove lock from writeCache in commitKVStoreCache
Browse files Browse the repository at this point in the history
  • Loading branch information
udpatil committed Nov 16, 2023
1 parent b619bae commit 4876150
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions store/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,9 @@ func (ckv *CommitKVStoreCache) getFromCache(key []byte) ([]byte, bool) {
// getAndWriteToCache queries the underlying CommitKVStore and writes the result
func (ckv *CommitKVStoreCache) getAndWriteToCache(key []byte) []byte {
ckv.mtx.RLock()
defer ckv.mtx.RUnlock()
value := ckv.CommitKVStore.Get(key)
ckv.mtx.RUnlock()
ckv.mtx.Lock()
ckv.cache.Add(string(key), value)
ckv.mtx.Unlock()
return value
}

Expand Down

0 comments on commit 4876150

Please sign in to comment.