Skip to content

Commit 667299f

Browse files
committed
slight log change
1 parent 34a3e26 commit 667299f

File tree

5 files changed

+31
-18
lines changed

5 files changed

+31
-18
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ members = ["compute", "p2p", "workflows", "utils", "monitor"]
44

55
[workspace.package]
66
edition = "2021"
7-
version = "0.2.25"
7+
version = "0.2.26"
88
license = "Apache-2.0"
99
readme = "README.md"
1010

compute/src/node.rs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::{
1515
handlers::*,
1616
utils::{crypto::secret_to_keypair, refresh_dria_nodes, DriaMessage},
1717
workers::workflow::{WorkflowsWorker, WorkflowsWorkerInput, WorkflowsWorkerOutput},
18+
DRIA_COMPUTE_NODE_VERSION,
1819
};
1920

2021
/// Number of seconds between refreshing for diagnostic prints.
@@ -413,22 +414,34 @@ impl DriaComputeNode {
413414

414415
/// Peer refresh simply reports the peer count to the user.
415416
async fn handle_diagnostic_refresh(&self) {
417+
let mut diagnostics = Vec::new();
416418
// print peer counts
417419
match self.p2p.peer_counts().await {
418-
Ok((mesh, all)) => log::info!("Peer Count (mesh/all): {} / {}", mesh, all),
420+
Ok((mesh, all)) => {
421+
diagnostics.push(format!("Peer Count (mesh/all): {} / {}", mesh, all))
422+
}
419423
Err(e) => log::error!("Error getting peer counts: {:?}", e),
420424
}
421425

422426
// print tasks count
423427
let [single, batch] = self.get_pending_task_count();
424-
log::info!("Pending Tasks (single/batch): {} / {}", single, batch);
425-
426-
// completed tasks count
427-
log::debug!(
428-
"Completed Tasks (single/batch): {} / {}",
429-
self.completed_tasks_single,
430-
self.completed_tasks_batch
431-
);
428+
diagnostics.push(format!(
429+
"Pending Tasks (single/batch): {} / {}",
430+
single, batch
431+
));
432+
433+
// completed tasks count is printed as well in debug
434+
if log::log_enabled!(log::Level::Debug) {
435+
diagnostics.push(format!(
436+
"Completed Tasks (single/batch): {} / {}",
437+
self.completed_tasks_single, self.completed_tasks_batch
438+
));
439+
}
440+
441+
// print version
442+
diagnostics.push(format!("Version: v{}", DRIA_COMPUTE_NODE_VERSION));
443+
444+
log::info!("{}", diagnostics.join(" | "));
432445
}
433446

434447
/// Updates the local list of available nodes by refreshing it.

compute/src/utils/nodes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use eyre::Result;
55
/// Refresh available nodes using the API.
66
pub async fn refresh_dria_nodes(nodes: &mut DriaNodes) -> Result<()> {
77
#[derive(serde::Deserialize, Debug)]
8-
struct AvailableNodesApiResponse {
8+
struct DriaNodesApiResponse {
99
pub bootstraps: Vec<String>,
1010
pub relays: Vec<String>,
1111
pub rpcs: Vec<String>,
@@ -22,7 +22,7 @@ pub async fn refresh_dria_nodes(nodes: &mut DriaNodes) -> Result<()> {
2222

2323
// make the request
2424
let response = reqwest::get(url).await?;
25-
let response_body = response.json::<AvailableNodesApiResponse>().await?;
25+
let response_body = response.json::<DriaNodesApiResponse>().await?;
2626
nodes
2727
.bootstrap_nodes
2828
.extend(parse_vec(response_body.bootstraps).unwrap_or_else(|e| {

p2p/src/nodes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ impl DriaNodes {
2323
Self {
2424
bootstrap_nodes: HashSet::new(),
2525
relay_nodes: HashSet::new(),
26-
rpc_peerids: HashSet::new(),
2726
rpc_nodes: HashSet::new(),
27+
rpc_peerids: HashSet::new(),
2828
network,
2929
}
3030
}

0 commit comments

Comments
 (0)