Skip to content

Commit

Permalink
Send call to get_largest_accounts to the background pool
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher committed Dec 19, 2024
1 parent aa83125 commit 4dde274
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,13 +1065,21 @@ impl JsonRpcRequestProcessor {
} else {
(HashSet::new(), AccountAddressFilter::Exclude)
};
let accounts = bank
.get_largest_accounts(
NUM_LARGEST_ACCOUNTS,
&addresses,
address_filter,
sort_results,
)
let accounts = self
.runtime
.spawn_blocking({
let bank = Arc::clone(&bank);
move || {
bank.get_largest_accounts(
NUM_LARGEST_ACCOUNTS,
&addresses,
address_filter,
sort_results,
)
}
})
.await
.expect("Failed to spawn blocking task")
.map_err(|e| RpcCustomError::ScanError {
message: e.to_string(),
})?
Expand Down

0 comments on commit 4dde274

Please sign in to comment.