This commit is contained in:
Anynomouss 2025-03-08 12:26:33 +00:00 committed by GitHub
commit 1c7db54ca1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 9 deletions
chain/src
p2p/src
servers/src
common
grin/sync

View file

@ -29,7 +29,7 @@ pub const RANGEPROOF_SEGMENT_HEIGHT: u8 = 11;
pub const KERNEL_SEGMENT_HEIGHT: u8 = 11;
/// Maximum number of received segments to cache (across all trees) before we stop requesting others
pub const MAX_CACHED_SEGMENTS: usize = 15;
pub const MAX_CACHED_SEGMENTS: usize = 150;
/// How long the state sync should wait after requesting a segment from a peer before
/// deciding the segment isn't going to arrive. The syncer will then re-request the segment

View file

@ -39,9 +39,9 @@ use std::time::{Duration, Instant};
use MsgHeaderWrapper::*;
use State::*;
const HEADER_IO_TIMEOUT: Duration = Duration::from_millis(2000);
const HEADER_IO_TIMEOUT: Duration = Duration::from_millis(20000);
pub const BODY_IO_TIMEOUT: Duration = Duration::from_millis(60000);
const HEADER_BATCH_SIZE: usize = 32;
const HEADER_BATCH_SIZE: usize = 256;
enum State {
None,
@ -76,7 +76,7 @@ impl Codec {
Self {
version,
stream,
buffer: BytesMut::with_capacity(8 * 1024),
buffer: BytesMut::with_capacity(256 * 1024),
state: None,
bytes_read: 0,
}

View file

@ -34,9 +34,9 @@ use std::sync::{mpsc, Arc};
use std::thread::{self, JoinHandle};
use std::time::Duration;
pub const SEND_CHANNEL_CAP: usize = 100;
pub const SEND_CHANNEL_CAP: usize = 1000;
const CHANNEL_TIMEOUT: Duration = Duration::from_millis(1000);
const CHANNEL_TIMEOUT: Duration = Duration::from_millis(10000);
/// A trait to be implemented in order to receive messages from the
/// connection. Allows providing an optional response.

View file

@ -15,6 +15,7 @@
//! Server types
use std::convert::From;
use std::sync::Arc;
use std::thread::available_parallelism;
use chrono::prelude::Utc;
use rand::prelude::*;
@ -293,11 +294,18 @@ pub struct WebHooksConfig {
}
fn default_timeout() -> u16 {
10
2 //10
}
fn default_nthreads() -> u16 {
4
let default_parallelism_approx = available_parallelism().unwrap().get() as u16;
if default_parallelism_approx > 4 {
warn!("Threads {:?}", default_parallelism_approx);
default_parallelism_approx
} else {
war!("Threads {:?}", 4);
4
}
}
impl Default for WebHooksConfig {

View file

@ -160,7 +160,7 @@ impl HeaderSync {
// resetting the timeout as long as we progress
if header_head.height > latest_height {
self.prev_header_sync =
(now + Duration::seconds(2), header_head.height, prev_height);
(now + Duration::seconds(1), header_head.height, prev_height);
}
false
}