From f22fc720f3de7093b0dad9b551be846b45e1e469 Mon Sep 17 00:00:00 2001 From: Rahul Sharma Date: Wed, 13 Nov 2024 13:57:36 +0000 Subject: [PATCH] sync with other branch --- cloud/linode/route_controller.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cloud/linode/route_controller.go b/cloud/linode/route_controller.go index 2116ee7a..8b3bdf47 100644 --- a/cloud/linode/route_controller.go +++ b/cloud/linode/route_controller.go @@ -27,12 +27,12 @@ type routeCache struct { } // RefreshCache checks if cache has expired and updates it accordingly -func (rc *routeCache) refreshRoutes(ctx context.Context, client client.Client) error { +func (rc *routeCache) refreshRoutes(ctx context.Context, client client.Client) { rc.Mu.Lock() defer rc.Mu.Unlock() if time.Since(rc.lastUpdate) < rc.ttl { - return nil + return } vpcNodes := map[int][]linodego.VPCIP{} @@ -54,7 +54,6 @@ func (rc *routeCache) refreshRoutes(ctx context.Context, client client.Client) e rc.routes = vpcNodes rc.lastUpdate = time.Now() - return nil } type routes struct { @@ -100,10 +99,7 @@ func (r *routes) instanceRoutesByID(id int) ([]linodego.VPCIP, error) { // getInstanceRoutes returns routes for given instance id // It refreshes routeCache if it has expired func (r *routes) getInstanceRoutes(ctx context.Context, id int) ([]linodego.VPCIP, error) { - if err := r.routeCache.refreshRoutes(ctx, r.client); err != nil { - return nil, err - } - + r.routeCache.refreshRoutes(ctx, r.client) return r.instanceRoutesByID(id) }