Skip to content

Commit

Permalink
chore(sync): add p2p sync server logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ShahakShama committed Jul 15, 2024
1 parent b1e0bdc commit da04765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 0 additions & 3 deletions crates/papyrus_network/src/network_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,6 @@ impl<SwarmT: SwarmTrait> GenericNetworkManager<SwarmT> {
peer_id: _,
protocol_name,
} => {
info!(
"Received new inbound query: {query:?} for session id: {inbound_session_id:?}"
);
self.num_active_inbound_sessions += 1;
gauge!(
papyrus_metrics::PAPYRUS_NUM_ACTIVE_INBOUND_SESSIONS,
Expand Down
5 changes: 4 additions & 1 deletion crates/papyrus_p2p_sync/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use starknet_api::block::BlockNumber;
use starknet_api::core::ClassHash;
use starknet_api::state::ThinStateDiff;
use starknet_api::transaction::{Event, Transaction, TransactionHash, TransactionOutput};
use tracing::error;
use tracing::{error, info};

#[cfg(test)]
mod test;
Expand Down Expand Up @@ -204,6 +204,7 @@ where
Sender: Sink<DataOrFin<Data>> + Unpin + Send + 'static,
P2PSyncServerError: From<<Sender as Sink<DataOrFin<Data>>>::Error>,
{
info!("Got a new inbound query {query:?}");
let storage_reader_clone = self.storage_reader.clone();
tokio::task::spawn(async move {
let result = send_data_for_query(storage_reader_clone, query.clone(), sender).await;
Expand Down Expand Up @@ -401,6 +402,7 @@ where
{
// If this function fails, we still want to send fin before failing.
let result = send_data_without_fin_for_query(&storage_reader, query, &mut sender).await;
info!("Sending fin message");
sender.feed(DataOrFin(None)).await?;
result
}
Expand Down Expand Up @@ -432,6 +434,7 @@ where
let data_vec = Data::fetch_block_data_from_db(block_number, &txn)?;
for data in data_vec {
// TODO: consider implement retry mechanism.
info!("Sending data");
sender.feed(DataOrFin(Some(data))).await?;
}
}
Expand Down

0 comments on commit da04765

Please sign in to comment.