From 64c36e00ecea1540aec4581feef78eeee15144c2 Mon Sep 17 00:00:00 2001 From: Tharsanan1 Date: Mon, 8 Jan 2024 12:03:30 +0530 Subject: [PATCH] Improve backend processing logic --- .../internal/operator/controllers/dp/api_controller.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/adapter/internal/operator/controllers/dp/api_controller.go b/adapter/internal/operator/controllers/dp/api_controller.go index 857531f06..467079562 100644 --- a/adapter/internal/operator/controllers/dp/api_controller.go +++ b/adapter/internal/operator/controllers/dp/api_controller.go @@ -772,9 +772,11 @@ func (apiReconciler *APIReconciler) getResolvedBackendsMapping(ctx context.Conte Name: string(backend.Name), Namespace: utils.GetNamespace(backend.Namespace, httpRoute.Namespace), } - resolvedBackend := utils.GetResolvedBackend(ctx, apiReconciler.client, backendNamespacedName, &api) - if resolvedBackend != nil { - backendMapping[backendNamespacedName.String()] = resolvedBackend + if _, exists := backendMapping[backendNamespacedName.String()]; !exists { + resolvedBackend := utils.GetResolvedBackend(ctx, apiReconciler.client, backendNamespacedName, &api) + if resolvedBackend != nil { + backendMapping[backendNamespacedName.String()] = resolvedBackend + } } } }