mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-26 08:15:17 +00:00
Merge 07704fedc9
into 1de7afec14
This commit is contained in:
commit
d792cc9979
@ -1,7 +1,7 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate tracing;
|
extern crate tracing;
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::{anyhow, bail};
|
||||||
use shared_types::{
|
use shared_types::{
|
||||||
Chunk, ChunkArray, ChunkArrayWithProof, DataRoot, FlowProof, FlowRangeProof, Transaction,
|
Chunk, ChunkArray, ChunkArrayWithProof, DataRoot, FlowProof, FlowRangeProof, Transaction,
|
||||||
};
|
};
|
||||||
@ -140,17 +140,21 @@ impl Store {
|
|||||||
let store = self.store.clone();
|
let store = self.store.clone();
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
|
|
||||||
self.executor.spawn_blocking(
|
self.executor
|
||||||
move || {
|
.spawn_blocking_handle(
|
||||||
// FIXME(zz): Not all functions need `write`. Refactor store usage.
|
move || {
|
||||||
let res = f(&*store);
|
// FIXME(zz): Not all functions need `write`. Refactor store usage.
|
||||||
|
let res = f(&*store);
|
||||||
|
|
||||||
if tx.send(res).is_err() {
|
if tx.send(res).is_err() {
|
||||||
error!("Unable to complete async storage operation: the receiver dropped");
|
error!("Unable to complete async storage operation: the receiver dropped");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
WORKER_TASK_NAME,
|
WORKER_TASK_NAME,
|
||||||
);
|
)
|
||||||
|
.ok_or(anyhow!("Unable to spawn async storage work"))?
|
||||||
|
.await
|
||||||
|
.map_err(|e| anyhow!("join error: e={:?}", e))?;
|
||||||
|
|
||||||
rx.await
|
rx.await
|
||||||
.unwrap_or_else(|_| bail!(error::Error::Custom("Receiver error".to_string())))
|
.unwrap_or_else(|_| bail!(error::Error::Custom("Receiver error".to_string())))
|
||||||
|
Loading…
Reference in New Issue
Block a user