Skip to content

Commit

Permalink
Merge pull request #1102 from subspace/record-cache-size-cleanup
Browse files Browse the repository at this point in the history
Simplify cache size handling and make it explicit
  • Loading branch information
nazar-pc authored Jan 23, 2023
2 parents b6ac622 + 51b3228 commit e31ee81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use tokio::runtime::Handle;
use tokio::sync::Semaphore;
use tracing::{debug, info, trace, warn, Instrument, Span};

const MAX_KADEMLIA_RECORDS_NUMBER: usize = 32768;
const MAX_CONCURRENT_ANNOUNCEMENTS_QUEUE: usize = 2000;
const MAX_CONCURRENT_ANNOUNCEMENTS_PROCESSING: NonZeroUsize =
NonZeroUsize::new(20).expect("Not zero; qed");
Expand All @@ -51,10 +50,6 @@ pub(super) async fn configure_dsn(
),
anyhow::Error,
> {
let record_cache_size = NonZeroUsize::new(record_cache_size).unwrap_or(
NonZeroUsize::new(MAX_KADEMLIA_RECORDS_NUMBER)
.expect("We don't expect an error on manually set value."),
);
let weak_readers_and_pieces = Arc::downgrade(readers_and_pieces);

let record_cache_db_path = base_path.join("records_cache_db").into_boxed_path();
Expand Down
4 changes: 2 additions & 2 deletions crates/subspace-farmer/src/bin/subspace-farmer/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ struct DsnArgs {
#[arg(long, default_value = "/ip4/0.0.0.0/tcp/30533")]
listen_on: Vec<Multiaddr>,
/// Record cache size in items.
#[arg(long, default_value_t = 65536)]
record_cache_size: usize,
#[arg(long, default_value = "65536")]
record_cache_size: NonZeroUsize,
/// Determines whether we allow keeping non-global (private, shared, loopback..) addresses in Kademlia DHT.
#[arg(long, default_value_t = false)]
disable_private_ips: bool,
Expand Down

0 comments on commit e31ee81

Please sign in to comment.