mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-15 23:38:19 +00:00
switch to standard lock to help cache perf (#730)
This commit is contained in:
parent
19804fd971
commit
875b19b2b4
@ -358,8 +358,10 @@ func (c *Coherent) View(ctx context.Context, tx kv.Tx) (CacheView, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Coherent) getFromCache(k []byte, id uint64, code bool) (*Element, *CoherentRoot, error) {
|
func (c *Coherent) getFromCache(k []byte, id uint64, code bool) (*Element, *CoherentRoot, error) {
|
||||||
c.lock.RLock()
|
// using the full lock here rather than RLock as RLock causes a lot of calls to runtime.usleep degrading
|
||||||
defer c.lock.RUnlock()
|
// performance under load
|
||||||
|
c.lock.Lock()
|
||||||
|
defer c.lock.Unlock()
|
||||||
r, ok := c.roots[id]
|
r, ok := c.roots[id]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, r, fmt.Errorf("too old ViewID: %d, latestStateVersionID=%d", id, c.latestStateVersionID)
|
return nil, r, fmt.Errorf("too old ViewID: %d, latestStateVersionID=%d", id, c.latestStateVersionID)
|
||||||
|
Loading…
Reference in New Issue
Block a user