mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
perf: execute db read tasks on blocking pool (#2896)
This commit is contained in:
@ -312,7 +312,7 @@ where
|
|||||||
if this.full_block_cache.queue(block_hash, Either::Left(response_tx)) {
|
if this.full_block_cache.queue(block_hash, Either::Left(response_tx)) {
|
||||||
let client = this.client.clone();
|
let client = this.client.clone();
|
||||||
let action_tx = this.action_tx.clone();
|
let action_tx = this.action_tx.clone();
|
||||||
this.action_task_spawner.spawn(Box::pin(async move {
|
this.action_task_spawner.spawn_blocking(Box::pin(async move {
|
||||||
let res = client.block_by_hash(block_hash);
|
let res = client.block_by_hash(block_hash);
|
||||||
let _ = action_tx
|
let _ = action_tx
|
||||||
.send(CacheAction::BlockResult { block_hash, res });
|
.send(CacheAction::BlockResult { block_hash, res });
|
||||||
@ -330,7 +330,7 @@ where
|
|||||||
if this.full_block_cache.queue(block_hash, Either::Right(response_tx)) {
|
if this.full_block_cache.queue(block_hash, Either::Right(response_tx)) {
|
||||||
let client = this.client.clone();
|
let client = this.client.clone();
|
||||||
let action_tx = this.action_tx.clone();
|
let action_tx = this.action_tx.clone();
|
||||||
this.action_task_spawner.spawn(Box::pin(async move {
|
this.action_task_spawner.spawn_blocking(Box::pin(async move {
|
||||||
let res = client.block_by_hash(block_hash);
|
let res = client.block_by_hash(block_hash);
|
||||||
let _ = action_tx
|
let _ = action_tx
|
||||||
.send(CacheAction::BlockResult { block_hash, res });
|
.send(CacheAction::BlockResult { block_hash, res });
|
||||||
@ -350,7 +350,7 @@ where
|
|||||||
if this.receipts_cache.queue(block_hash, response_tx) {
|
if this.receipts_cache.queue(block_hash, response_tx) {
|
||||||
let client = this.client.clone();
|
let client = this.client.clone();
|
||||||
let action_tx = this.action_tx.clone();
|
let action_tx = this.action_tx.clone();
|
||||||
this.action_task_spawner.spawn(Box::pin(async move {
|
this.action_task_spawner.spawn_blocking(Box::pin(async move {
|
||||||
let res = client.receipts_by_block(block_hash.into());
|
let res = client.receipts_by_block(block_hash.into());
|
||||||
let _ = action_tx
|
let _ = action_tx
|
||||||
.send(CacheAction::ReceiptsResult { block_hash, res });
|
.send(CacheAction::ReceiptsResult { block_hash, res });
|
||||||
@ -369,7 +369,7 @@ where
|
|||||||
if this.evm_env_cache.queue(block_hash, response_tx) {
|
if this.evm_env_cache.queue(block_hash, response_tx) {
|
||||||
let client = this.client.clone();
|
let client = this.client.clone();
|
||||||
let action_tx = this.action_tx.clone();
|
let action_tx = this.action_tx.clone();
|
||||||
this.action_task_spawner.spawn(Box::pin(async move {
|
this.action_task_spawner.spawn_blocking(Box::pin(async move {
|
||||||
let mut cfg = CfgEnv::default();
|
let mut cfg = CfgEnv::default();
|
||||||
let mut block_env = BlockEnv::default();
|
let mut block_env = BlockEnv::default();
|
||||||
let res = client
|
let res = client
|
||||||
|
|||||||
Reference in New Issue
Block a user