mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-20 15:05:19 +00:00
Compare commits
3 Commits
1d32f19f54
...
ae08773df5
Author | SHA1 | Date | |
---|---|---|---|
|
ae08773df5 | ||
|
3fd800275a | ||
|
07704fedc9 |
@ -157,8 +157,8 @@ impl Default for Config {
|
||||
let filter_rate_limiter = Some(
|
||||
discv5::RateLimiterBuilder::new()
|
||||
.total_n_every(300, Duration::from_secs(1)) // Allow bursts, average 300 per second
|
||||
.ip_n_every(300, Duration::from_secs(1)) // Allow bursts, average 300 per second
|
||||
.node_n_every(300, Duration::from_secs(1)) // Allow bursts, average 300 per second
|
||||
.ip_n_every(9, Duration::from_secs(1)) // Allow bursts, average 9 per second
|
||||
.node_n_every(8, Duration::from_secs(1)) // Allow bursts, average 8 per second
|
||||
.build()
|
||||
.expect("The total rate limit has been specified"),
|
||||
);
|
||||
|
@ -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,
|
||||
};
|
||||
@ -136,17 +136,21 @@ impl Store {
|
||||
let store = self.store.clone();
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
self.executor.spawn_blocking(
|
||||
move || {
|
||||
// FIXME(zz): Not all functions need `write`. Refactor store usage.
|
||||
let res = f(&*store);
|
||||
self.executor
|
||||
.spawn_blocking_handle(
|
||||
move || {
|
||||
// FIXME(zz): Not all functions need `write`. Refactor store usage.
|
||||
let res = f(&*store);
|
||||
|
||||
if tx.send(res).is_err() {
|
||||
error!("Unable to complete async storage operation: the receiver dropped");
|
||||
}
|
||||
},
|
||||
WORKER_TASK_NAME,
|
||||
);
|
||||
if tx.send(res).is_err() {
|
||||
error!("Unable to complete async storage operation: the receiver dropped");
|
||||
}
|
||||
},
|
||||
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())))
|
||||
|
Loading…
Reference in New Issue
Block a user