This commit is contained in:
peilun-conflux 2024-11-12 17:26:12 +08:00 committed by GitHub
commit d792cc9979
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,7 @@
#[macro_use]
extern crate tracing;
use anyhow::bail;
use anyhow::{anyhow, bail};
use shared_types::{
Chunk, ChunkArray, ChunkArrayWithProof, DataRoot, FlowProof, FlowRangeProof, Transaction,
};
@ -140,7 +140,8 @@ impl Store {
let store = self.store.clone();
let (tx, rx) = oneshot::channel();
self.executor.spawn_blocking(
self.executor
.spawn_blocking_handle(
move || {
// FIXME(zz): Not all functions need `write`. Refactor store usage.
let res = f(&*store);
@ -150,7 +151,10 @@ impl Store {
}
},
WORKER_TASK_NAME,
);
)
.ok_or(anyhow!("Unable to spawn async storage work"))?
.await
.map_err(|e| anyhow!("join error: e={:?}", e))?;
rx.await
.unwrap_or_else(|_| bail!(error::Error::Custom("Receiver error".to_string())))