From a95bcba2ab9f88cf24ae09ccab7263014d82b476 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 19 Sep 2022 07:58:50 +0000 Subject: [PATCH] Avoid holding write-lock whilst waiting on shuffling cache promise (#3589) ## Issue Addressed NA ## Proposed Changes Fixes a bug which hogged the write-lock for the `shuffling_cache`. ## Additional Info NA --- beacon_node/beacon_chain/src/beacon_chain.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 609969a9a..a0377f5fc 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -4491,6 +4491,10 @@ impl BeaconChain { metrics::stop_timer(cache_wait_timer); if let Some(cache_item) = shuffling_cache.get(&shuffling_id) { + // The shuffling cache is no longer required, drop the write-lock to allow concurrent + // access. + drop(shuffling_cache); + let committee_cache = cache_item.wait()?; map_fn(&committee_cache, shuffling_id.shuffling_decision_block) } else {