mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-14 02:41:34 +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
|
var peerCopy nbpeer.Peer
|
||||||
peerCopy.Status = &peerStatus
|
peerCopy.Status = &peerStatus
|
||||||
|
|
||||||
|
if !peerStatus.Connected {
|
||||||
log.WithContext(context.Background()).Tracef("saving peer: %s with false status. PeerCopy %v, Arg: %v, Trace: %s",
|
log.WithContext(context.Background()).Tracef("saving peer: %s with false status. PeerCopy %v, Arg: %v, Trace: %s",
|
||||||
peerID, peerCopy.Status.Connected, peerStatus.Connected,
|
peerID, peerCopy.Status.Connected, peerStatus.Connected,
|
||||||
debug.Stack())
|
debug.Stack())
|
||||||
|
}
|
||||||
|
|
||||||
fieldsToUpdate := []string{
|
fieldsToUpdate := []string{
|
||||||
"peer_status_last_seen", "peer_status_connected",
|
"peer_status_last_seen", "peer_status_connected",
|
||||||
|
Loading…
Reference in New Issue
Block a user