Skip to content

Commit

Permalink
Merge pull request #2280 from maidsafe/chore-reduce_max_records_cache
Browse files Browse the repository at this point in the history
chore: reduce max records cache size
  • Loading branch information
jacderida authored Oct 21, 2024
2 parents 08f091b + 4dec0b2 commit 99e06f0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sn_networking/src/record_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use xor_name::XorName;
const MAX_RECORDS_COUNT: usize = 16 * 1024;

/// The maximum number of records to cache in memory.
const MAX_RECORDS_CACHE_SIZE: usize = 100;
const MAX_RECORDS_CACHE_SIZE: usize = 25;

/// File name of the recorded historical quoting metrics.
const HISTORICAL_QUOTING_METRICS_FILENAME: &str = "historic_quoting_metrics";
Expand Down
8 changes: 6 additions & 2 deletions sn_node/src/bin/safenode/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ use sn_logging::{Level, LogFormat, LogOutputDest, ReloadHandle};
use sn_node::{Marker, NodeBuilder, NodeEvent, NodeEventsReceiver};
use sn_peers_acquisition::PeersArgs;
use sn_protocol::{
node::get_safenode_root_dir, node_rpc::{NodeCtrl, StopResult}, version::IDENTIFY_PROTOCOL_STR,
node::get_safenode_root_dir,
node_rpc::{NodeCtrl, StopResult},
version::IDENTIFY_PROTOCOL_STR,
};
use std::{
env,
Expand Down Expand Up @@ -530,7 +532,9 @@ fn monitor_node_events(mut node_events_rx: NodeEventsReceiver, ctrl_tx: mpsc::Se
})
.await
{
error!("Failed to send node control msg to safenode bin main thread: {err}");
error!(
"Failed to send node control msg to safenode bin main thread: {err}"
);
break;
}
}
Expand Down
9 changes: 8 additions & 1 deletion sn_node/src/bin/safenode/rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,14 @@ impl SafeNode for SafeNodeRpcService {
};

let delay = Duration::from_millis(request.get_ref().delay_millis);
match self.ctrl_tx.send(NodeCtrl::Stop { delay, result: StopResult::Success(cause.to_string()) }).await {
match self
.ctrl_tx
.send(NodeCtrl::Stop {
delay,
result: StopResult::Success(cause.to_string()),
})
.await
{
Ok(()) => Ok(Response::new(StopResponse {})),
Err(err) => Err(Status::new(
Code::Internal,
Expand Down

0 comments on commit 99e06f0

Please sign in to comment.