mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
No string in slog (#2017)
## Issue Addressed Following slog's documentation, this should help a bit with string allocations. I left it run for two days and mem usage is lower. This is of course anecdotal, but shouldn't harm anyway ## Proposed Changes remove `String` creation in logs when possible
This commit is contained in:
@@ -225,14 +225,14 @@ impl<T: BeaconChainTypes> Router<T> {
|
||||
self.processor.on_block_gossip(id, peer_id, block);
|
||||
}
|
||||
PubsubMessage::VoluntaryExit(exit) => {
|
||||
debug!(self.log, "Received a voluntary exit"; "peer_id" => format!("{}", peer_id));
|
||||
debug!(self.log, "Received a voluntary exit"; "peer_id" => %peer_id);
|
||||
self.processor.on_voluntary_exit_gossip(id, peer_id, exit);
|
||||
}
|
||||
PubsubMessage::ProposerSlashing(proposer_slashing) => {
|
||||
debug!(
|
||||
self.log,
|
||||
"Received a proposer slashing";
|
||||
"peer_id" => format!("{}", peer_id)
|
||||
"peer_id" => %peer_id
|
||||
);
|
||||
self.processor
|
||||
.on_proposer_slashing_gossip(id, peer_id, proposer_slashing);
|
||||
@@ -241,7 +241,7 @@ impl<T: BeaconChainTypes> Router<T> {
|
||||
debug!(
|
||||
self.log,
|
||||
"Received a attester slashing";
|
||||
"peer_id" => format!("{}", peer_id)
|
||||
"peer_id" => %peer_id
|
||||
);
|
||||
self.processor
|
||||
.on_attester_slashing_gossip(id, peer_id, attester_slashing);
|
||||
|
||||
@@ -179,7 +179,7 @@ impl<T: BeaconChainTypes> Processor<T> {
|
||||
trace!(
|
||||
self.log,
|
||||
"Received BlocksByRange Response";
|
||||
"peer" => peer_id.to_string(),
|
||||
"peer" => %peer_id,
|
||||
);
|
||||
|
||||
if let RequestId::Sync(id) = request_id {
|
||||
@@ -206,7 +206,7 @@ impl<T: BeaconChainTypes> Processor<T> {
|
||||
trace!(
|
||||
self.log,
|
||||
"Received BlocksByRoot Response";
|
||||
"peer" => peer_id.to_string(),
|
||||
"peer" => %peer_id,
|
||||
);
|
||||
|
||||
if let RequestId::Sync(id) = request_id {
|
||||
@@ -356,10 +356,9 @@ impl<T: EthSpec> HandlerNetworkContext<T> {
|
||||
|
||||
/// Sends a message to the network task.
|
||||
fn inform_network(&mut self, msg: NetworkMessage<T>) {
|
||||
let msg_r = &format!("{:?}", msg);
|
||||
self.network_send
|
||||
.send(msg)
|
||||
.unwrap_or_else(|e| warn!(self.log, "Could not send message to the network service"; "error" => %e, "message" => msg_r))
|
||||
self.network_send.send(msg).unwrap_or_else(
|
||||
|e| warn!(self.log, "Could not send message to the network service"; "error" => %e),
|
||||
)
|
||||
}
|
||||
|
||||
/// Disconnects and ban's a peer, sending a Goodbye request with the associated reason.
|
||||
|
||||
Reference in New Issue
Block a user