Skip to content

Commit

Permalink
Make get_first_available_block() yieldy
Browse files Browse the repository at this point in the history
When this method reaches out to blockstore, yield the thread
  • Loading branch information
steveluscher committed Dec 10, 2024
1 parent 5302961 commit ebb6c57
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1914,9 +1914,13 @@ impl JsonRpcRequestProcessor {

pub async fn get_first_available_block(&self) -> Slot {
let slot = self
.blockstore
.get_first_available_block()
.unwrap_or_default();
.runtime
.spawn_blocking({
let blockstore = Arc::clone(&self.blockstore);
move || blockstore.get_first_available_block().unwrap_or_default()
})
.await
.expect("Failed to spawn blocking task");

if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
let bigtable_slot = bigtable_ledger_storage
Expand Down

0 comments on commit ebb6c57

Please sign in to comment.