From bb882c8303523429845c20ea268633207f3ab245 Mon Sep 17 00:00:00 2001 From: bcmmbaga Date: Fri, 20 Dec 2024 11:22:18 +0300 Subject: [PATCH] Fix sonar Signed-off-by: bcmmbaga --- management/server/types/account.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/management/server/types/account.go b/management/server/types/account.go index 3d6e414d4ba..30ab5a18351 100644 --- a/management/server/types/account.go +++ b/management/server/types/account.go @@ -1309,11 +1309,11 @@ func (a *Account) GetNetworkResourcesRoutesToSync(ctx context.Context, peerID st var allSourcePeers []string for _, resource := range a.NetworkResources { - - if networkRoutingPeers, exists := routers[resource.NetworkID]; exists { - if _, ok := networkRoutingPeers[peerID]; ok { + networkRoutingPeers, exists := routers[resource.NetworkID] + if exists { + if router, ok := networkRoutingPeers[peerID]; ok { isRoutingPeer = true - routes = append(routes, a.getNetworkResourcesRoutes(resource, peerID, networkRoutingPeers[peerID], resourcePolicies)...) + routes = append(routes, a.getNetworkResourcesRoutes(resource, peerID, router, resourcePolicies)...) } } @@ -1326,10 +1326,8 @@ func (a *Account) GetNetworkResourcesRoutesToSync(ctx context.Context, peerID st } // routing peer should be able to connect with all source peers - if networkRoutingPeers, exists := routers[resource.NetworkID]; exists { - if _, ok := networkRoutingPeers[peerID]; ok { - allSourcePeers = append(allSourcePeers, group.Peers...) - } + if _, ok := networkRoutingPeers[peerID]; ok { + allSourcePeers = append(allSourcePeers, group.Peers...) } // add routes for the resource if the peer is in the distribution group