Skip to content

Commit

Permalink
Merge pull request #2317 from joshuef/ReduceKadBoot
Browse files Browse the repository at this point in the history
feat(kad): reduce bootstrap interval
  • Loading branch information
maqi authored Oct 25, 2024
2 parents 95eaf9c + b17da95 commit d0d368c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sn_networking/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ const NETWORKING_CHANNEL_SIZE: usize = 10_000;
/// Time before a Kad query times out if no response is received
const KAD_QUERY_TIMEOUT_S: Duration = Duration::from_secs(10);

/// Periodic bootstrap interval
const KAD_PERIODIC_BOOTSTRAP_INTERVAL_S: Duration = Duration::from_secs(180 * 60);

// Init during compilation, instead of runtime error that should never happen
// Option<T>::expect will be stabilised as const in the future (https://github.com/rust-lang/rust/issues/67441)
const REPLICATION_FACTOR: NonZeroUsize = match NonZeroUsize::new(CLOSE_GROUP_SIZE) {
Expand Down Expand Up @@ -363,6 +366,7 @@ impl NetworkBuilder {
// Records never expire
.set_record_ttl(None)
.set_replication_factor(REPLICATION_FACTOR)
.set_periodic_bootstrap_interval(Some(KAD_PERIODIC_BOOTSTRAP_INTERVAL_S))
// Emit PUT events for validation prior to insertion into the RecordStore.
// This is no longer needed as the record_storage::put now can carry out validation.
// .set_record_filtering(KademliaStoreInserts::FilterBoth)
Expand Down

0 comments on commit d0d368c

Please sign in to comment.