mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-24 23:35:18 +00:00
Handle chunk write of rpc in parallel. (#126)
* Handle chunk write of rpc in parallel. * double mine period. * Increase the log sync channel capacity. * Increase capacity.
This commit is contained in:
parent
b1c52c7ad6
commit
504a67fdd0
@ -265,12 +265,17 @@ impl MemoryChunkPool {
|
||||
Ok(LogSyncEvent::ReorgDetected { .. }) => {}
|
||||
Ok(LogSyncEvent::Reverted { .. }) => {}
|
||||
Ok(LogSyncEvent::TxSynced { tx }) => {
|
||||
if let Err(e) = chunk_pool.update_file_info(&tx).await {
|
||||
error!(
|
||||
"Failed to update file info. tx seq={}, tx_root={}, error={}",
|
||||
tx.seq, tx.data_merkle_root, e
|
||||
);
|
||||
}
|
||||
// This may take a while, so execute it asynchronously to ensure the
|
||||
// channel will not be saturated.
|
||||
let chunk_pool_cloned = chunk_pool.clone();
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = chunk_pool_cloned.update_file_info(&tx).await {
|
||||
error!(
|
||||
"Failed to update file info. tx seq={}, tx_root={}, error={}",
|
||||
tx.seq, tx.data_merkle_root, e
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
Err(RecvError::Closed) => {
|
||||
// program terminated
|
||||
|
@ -19,7 +19,9 @@ use tokio::sync::mpsc::UnboundedReceiver;
|
||||
use tokio::sync::{oneshot, RwLock};
|
||||
|
||||
const RETRY_WAIT_MS: u64 = 500;
|
||||
const BROADCAST_CHANNEL_CAPACITY: usize = 16;
|
||||
|
||||
// A RPC query can return at most 10000 entries.
|
||||
const BROADCAST_CHANNEL_CAPACITY: usize = 10000;
|
||||
const CATCH_UP_END_GAP: u64 = 10;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -13,7 +13,7 @@ class MineTest(TestFramework):
|
||||
self.zgs_node_configs[0] = {
|
||||
"miner_key": GENESIS_PRIV_KEY,
|
||||
}
|
||||
self.mine_period = int(20 / self.block_time)
|
||||
self.mine_period = int(40 / self.block_time)
|
||||
self.launch_wait_seconds = 15
|
||||
self.log.info("Contract Info: Est. block time %.2f, Mine period %d", self.block_time, self.mine_period)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user