From abf6a1e08ee0bee78ea3f24f05da084153edf064 Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Thu, 8 May 2025 13:26:01 +0200 Subject: [PATCH] add timing logs --- management/server/peer.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/management/server/peer.go b/management/server/peer.go index 36577729a..6a8a0dc63 100644 --- a/management/server/peer.go +++ b/management/server/peer.go @@ -1174,13 +1174,15 @@ func (am *DefaultAccountManager) checkIfUserOwnsPeer(ctx context.Context, accoun // UpdateAccountPeers updates all peers that belong to an account. // Should be called when changes have to be synced to peers. func (am *DefaultAccountManager) UpdateAccountPeers(ctx context.Context, accountID string) { + start := time.Now() account, err := am.requestBuffer.GetAccountWithBackpressure(ctx, accountID) if err != nil { log.WithContext(ctx).Errorf("failed to send out updates to peers. failed to get account: %v", err) 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) if err != nil { @@ -1188,6 +1190,8 @@ func (am *DefaultAccountManager) UpdateAccountPeers(ctx context.Context, account return } + log.WithContext(ctx).Infof("updateAccountPeers: validatePeers took %s", time.Since(start)) + var wg sync.WaitGroup semaphore := make(chan struct{}, 10) @@ -1198,11 +1202,14 @@ func (am *DefaultAccountManager) UpdateAccountPeers(ctx context.Context, account routers := account.GetResourceRoutersMap() for _, peer := range account.Peers { + startProxy := time.Now() proxyNetworkMaps, err := am.proxyController.GetProxyNetworkMaps(ctx, accountID, peer.ID) if err != nil { log.WithContext(ctx).Errorf("failed to get proxy network maps: %v", err) return } + log.WithContext(ctx).Infof("updateAccountPeers: getProxyNetworkMaps took %s", time.Since(startProxy)) + if !am.peersUpdateManager.HasChannel(peer.ID) { log.WithContext(ctx).Tracef("peer %s doesn't have a channel, skipping network map update", peer.ID) continue