mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-30 08:19:09 +01:00
add timing logs
This commit is contained in:
@@ -1174,13 +1174,15 @@ func (am *DefaultAccountManager) checkIfUserOwnsPeer(ctx context.Context, accoun
|
|||||||
// UpdateAccountPeers updates all peers that belong to an account.
|
// UpdateAccountPeers updates all peers that belong to an account.
|
||||||
// Should be called when changes have to be synced to peers.
|
// Should be called when changes have to be synced to peers.
|
||||||
func (am *DefaultAccountManager) UpdateAccountPeers(ctx context.Context, accountID string) {
|
func (am *DefaultAccountManager) UpdateAccountPeers(ctx context.Context, accountID string) {
|
||||||
|
start := time.Now()
|
||||||
account, err := am.requestBuffer.GetAccountWithBackpressure(ctx, accountID)
|
account, err := am.requestBuffer.GetAccountWithBackpressure(ctx, accountID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithContext(ctx).Errorf("failed to send out updates to peers. failed to get account: %v", err)
|
log.WithContext(ctx).Errorf("failed to send out updates to peers. failed to get account: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log.WithContext(ctx).Infof("updateAccountPeers: getAccount took %s", time.Since(start))
|
||||||
|
|
||||||
start := time.Now()
|
start = time.Now()
|
||||||
|
|
||||||
approvedPeersMap, err := am.integratedPeerValidator.GetValidatedPeers(account.Id, maps.Values(account.Groups), maps.Values(account.Peers), account.Settings.Extra)
|
approvedPeersMap, err := am.integratedPeerValidator.GetValidatedPeers(account.Id, maps.Values(account.Groups), maps.Values(account.Peers), account.Settings.Extra)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1188,6 +1190,8 @@ func (am *DefaultAccountManager) UpdateAccountPeers(ctx context.Context, account
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.WithContext(ctx).Infof("updateAccountPeers: validatePeers took %s", time.Since(start))
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
semaphore := make(chan struct{}, 10)
|
semaphore := make(chan struct{}, 10)
|
||||||
|
|
||||||
@@ -1198,11 +1202,14 @@ func (am *DefaultAccountManager) UpdateAccountPeers(ctx context.Context, account
|
|||||||
routers := account.GetResourceRoutersMap()
|
routers := account.GetResourceRoutersMap()
|
||||||
|
|
||||||
for _, peer := range account.Peers {
|
for _, peer := range account.Peers {
|
||||||
|
startProxy := time.Now()
|
||||||
proxyNetworkMaps, err := am.proxyController.GetProxyNetworkMaps(ctx, accountID, peer.ID)
|
proxyNetworkMaps, err := am.proxyController.GetProxyNetworkMaps(ctx, accountID, peer.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithContext(ctx).Errorf("failed to get proxy network maps: %v", err)
|
log.WithContext(ctx).Errorf("failed to get proxy network maps: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log.WithContext(ctx).Infof("updateAccountPeers: getProxyNetworkMaps took %s", time.Since(startProxy))
|
||||||
|
|
||||||
if !am.peersUpdateManager.HasChannel(peer.ID) {
|
if !am.peersUpdateManager.HasChannel(peer.ID) {
|
||||||
log.WithContext(ctx).Tracef("peer %s doesn't have a channel, skipping network map update", peer.ID)
|
log.WithContext(ctx).Tracef("peer %s doesn't have a channel, skipping network map update", peer.ID)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user