Skip to content

Commit

Permalink
chore: trace log from every task wakeup
Browse files Browse the repository at this point in the history
  • Loading branch information
dpc committed Feb 23, 2025
1 parent d09a0ce commit 68a64ac
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions crates/rostra-client/src/task/followee_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ impl FolloweeChecker {

}
}
trace!(target: LOG_TARGET, "Woke up");

// Query only new followees
for (followee_id, _persona_id) in &self_followees {
Expand Down
3 changes: 2 additions & 1 deletion crates/rostra-client/src/task/followee_head_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rostra_util_error::{BoxedErrorResult, FmtCompact, WhateverResult};
use rostra_util_fmt::AsFmtOption as _;
use snafu::ResultExt as _;
use tokio::sync::watch;
use tracing::{debug, info, instrument};
use tracing::{debug, info, instrument, trace};

use crate::client::Client;
use crate::ClientRef;
Expand Down Expand Up @@ -64,6 +64,7 @@ impl FolloweeHeadChecker {
}
}
}
trace!(target: LOG_TARGET, "Woke up");

let Ok(storage) = self.client.db() else {
break;
Expand Down
3 changes: 2 additions & 1 deletion crates/rostra-client/src/task/head_merger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rostra_core::event::{EventKind, VerifiedEvent};
use rostra_core::id::{RostraId, RostraIdSecretKey};
use rostra_core::{Event, ShortEventId};
use tokio::sync::watch;
use tracing::{debug, instrument};
use tracing::{debug, instrument, trace};

use crate::client::Client;
const LOG_TARGET: &str = "rostra::head_merger";
Expand Down Expand Up @@ -33,6 +33,7 @@ impl HeadMerger {
pub async fn run(self) {
let mut head_rx = self.self_head_rx.clone();
while let Ok(_head) = head_rx.changed().await {
trace!(target: LOG_TARGET, "Woke up" );
// To avoid two active nodes merging heads together at the same time, producing
// more heads, that require more merging, etc., we just sleep a random period of
// time here, which should be enough to propagate and eventually desynchronize.
Expand Down
3 changes: 2 additions & 1 deletion crates/rostra-client/src/task/head_update_broadcaster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rostra_p2p::connection::{Connection, FeedEventRequest};
use rostra_util_error::{FmtCompact, WhateverResult};
use snafu::ResultExt as _;
use tokio::sync::watch;
use tracing::{debug, instrument, warn};
use tracing::{debug, instrument, trace, warn};

use crate::client::Client;
use crate::ClientRef;
Expand Down Expand Up @@ -54,6 +54,7 @@ impl HeadUpdateBroadcaster {
}
}
}
trace!(target: LOG_TARGET, "Woke up");

let Some(head) = *self_head_rx.borrow() else {
warn!(target: LOG_TARGET, "Empty head!?");
Expand Down
3 changes: 2 additions & 1 deletion crates/rostra-client/src/task/missing_event_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rostra_core::ShortEventId;
use rostra_p2p::Connection;
use rostra_util_error::{BoxedErrorResult, FmtCompact, WhateverResult};
use snafu::ResultExt as _;
use tracing::{debug, instrument, warn};
use tracing::{debug, instrument, trace, warn};

use crate::client::Client;
use crate::{ClientHandle, LOG_TARGET};
Expand Down Expand Up @@ -43,6 +43,7 @@ impl MissingEventFetcher {
continue;
}
};
trace!(target: LOG_TARGET, "Woke up");

let Ok(db) = self.client.db() else {
break;
Expand Down
1 change: 1 addition & 0 deletions crates/rostra-client/src/task/pkarr_id_publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl PkarrIdPublisher {
}
}
}
trace!(target: LOG_TARGET, "Woke up");

self.wait_for_your_turn().await;
debug!(target: LOG_TARGET, "Detect no other peer alive, assuming the role of Pkarr ID publisher");
Expand Down
1 change: 1 addition & 0 deletions crates/rostra-client/src/task/request_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl RequestHandler {
return;
};

trace!(target: LOG_TARGET, "New connection" );
tokio::spawn(self.clone().handle_incoming(incoming));
}
}
Expand Down

0 comments on commit 68a64ac

Please sign in to comment.