mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-12 09:50:47 +01:00
Refactor log statement for peer status trace
Move the peer status trace log inside a conditional block to ensure it only logs when the peer status is not connected. This refactor prevents unnecessary logging and streamlines the execution trace.
This commit is contained in:
parent
5d81e7aa0c
commit
f2f5609c6e
@ -309,9 +309,11 @@ func (s *SqlStore) SavePeerStatus(accountID, peerID string, peerStatus nbpeer.Pe
|
||||
var peerCopy nbpeer.Peer
|
||||
peerCopy.Status = &peerStatus
|
||||
|
||||
log.WithContext(context.Background()).Tracef("saving peer: %s with false status. PeerCopy %v, Arg: %v, Trace: %s",
|
||||
peerID, peerCopy.Status.Connected, peerStatus.Connected,
|
||||
debug.Stack())
|
||||
if !peerStatus.Connected {
|
||||
log.WithContext(context.Background()).Tracef("saving peer: %s with false status. PeerCopy %v, Arg: %v, Trace: %s",
|
||||
peerID, peerCopy.Status.Connected, peerStatus.Connected,
|
||||
debug.Stack())
|
||||
}
|
||||
|
||||
fieldsToUpdate := []string{
|
||||
"peer_status_last_seen", "peer_status_connected",
|
||||
|
Loading…
Reference in New Issue
Block a user