Skip to content

Commit

Permalink
fix(core): improve logging of dropped reply channels
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Sep 20, 2022
1 parent abde8e8 commit 2d878b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
14 changes: 8 additions & 6 deletions base_layer/core/src/base_node/service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ where B: BlockchainBackend + 'static
let result = handle_incoming_block(inbound_nch, new_block).await;

match result {
Ok(()) => {},
Err(BaseNodeServiceError::CommsInterfaceError(CommsInterfaceError::ChainStorageError(
ChainStorageError::AddBlockOperationLocked,
))) => {
// Special case, dont log this again as an error
},
Err(e) => error!(target: LOG_TARGET, "Failed to handle incoming block message: {:?}", e),
_ => {},
Err(e) => error!(target: LOG_TARGET, "Failed to handle incoming block message: {}", e),
}
});
}
Expand All @@ -324,10 +324,11 @@ where B: BlockchainBackend + 'static
);
}
let result = reply_tx.send(res);
if let Err(e) = result {
if let Err(res) = result {
error!(
target: LOG_TARGET,
"BaseNodeService failed to send reply to local request {:?}", e
"BaseNodeService failed to send reply to local request {:?}",
res.map(|r| r.to_string()).map_err(|e| e.to_string())
);
}
});
Expand All @@ -339,10 +340,11 @@ where B: BlockchainBackend + 'static
let (block, reply_tx) = block_context.split();
let result = reply_tx.send(inbound_nch.handle_block(Arc::new(block), None).await);

if let Err(e) = result {
if let Err(res) = result {
error!(
target: LOG_TARGET,
"BaseNodeService failed to send reply to local block submitter {:?}", e
"BaseNodeService failed to send reply to local block submitter {:?}",
res.map(|r| r.to_string()).map_err(|e| e.to_string())
);
}
});
Expand Down
19 changes: 10 additions & 9 deletions base_layer/core/src/mempool/service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ impl MempoolService {
// Incoming transaction messages from the Comms layer
Some(transaction_msg) = inbound_transaction_stream.next() => {
let result = handle_incoming_tx(&mut self.inbound_handlers, transaction_msg).await;
if let Err(e) = result {
error!(
target: LOG_TARGET,
"Failed to handle incoming transaction message: {:?}", e
);
}
if let Err(e) = result {
error!(
target: LOG_TARGET,
"Failed to handle incoming transaction message: {:?}", e
);
}
}

// Incoming local request messages from the LocalMempoolServiceInterface and other local services
Expand Down Expand Up @@ -152,10 +152,11 @@ impl MempoolService {
let (request, reply_tx) = request_context.split();
let result = reply_tx.send(inbound_handlers.handle_request(request).await);

if let Err(e) = result {
if let Err(res) = result {
error!(
target: LOG_TARGET,
"MempoolService failed to send reply to local request {:?}", e
"MempoolService failed to send reply to local request {:?}",
res.map(|r| r.to_string()).map_err(|e| e.to_string())
);
}
});
Expand All @@ -166,7 +167,7 @@ impl MempoolService {
task::spawn(async move {
let result = inbound_handlers.handle_block_event(&block_event).await;
if let Err(e) = result {
error!(target: LOG_TARGET, "Failed to handle base node block event: {:?}", e);
error!(target: LOG_TARGET, "Failed to handle base node block event: {}", e);
}
});
}
Expand Down

0 comments on commit 2d878b9

Please sign in to comment.