Added number of test packets to healthcheck config

This commit is contained in:
Jedrzej Stuczynski
2020-01-09 16:30:56 +00:00
parent 6e52afef79
commit 89e17b0ffa
3 changed files with 11 additions and 2 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
[healthcheck]
directory-server = "http://localhost:8080"
interval = 10.0
interval = 10.0
test-packets-per-node = 2
+3
View File
@@ -12,4 +12,7 @@ pub struct HealthCheck {
pub directory_server: String,
pub interval: f64, // in seconds
#[serde(rename(deserialize = "test-packets-per-node"))]
pub num_test_packets: usize,
}
+6 -1
View File
@@ -130,6 +130,7 @@ impl std::fmt::Display for NodeScore {
pub(crate) struct HealthChecker {
directory_client: directory_client::Client,
interval: Duration,
num_test_packets: usize,
}
impl HealthChecker {
@@ -142,6 +143,7 @@ impl HealthChecker {
HealthChecker {
directory_client: directory_client::Client::new(directory_client_config),
interval: Duration::from_secs_f64(config.interval),
num_test_packets: config.num_test_packets,
}
}
@@ -166,7 +168,10 @@ impl HealthChecker {
}
pub async fn run(self) -> Result<(), HealthCheckerError> {
debug!("healthcheck will run every {:?}", self.interval,);
debug!(
"healthcheck will run every {:?} and will send {} packets to each node",
self.interval, self.num_test_packets
);
loop {
match self.do_check() {