This is an automated email from the ASF dual-hosted git repository.

tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 76bfd45  fix: Avoid retrying caused by 404 when deleting cache  (#424)
76bfd45 is described below

commit 76bfd4593d3a4cecf97d94cb9ded5271b3bdcc6c
Author: kv <[email protected]>
AuthorDate: Sat May 8 16:54:33 2021 +0800

    fix: Avoid retrying caused by 404 when deleting cache  (#424)
---
 pkg/apisix/global_rule.go  | 4 +++-
 pkg/apisix/route.go        | 4 +++-
 pkg/apisix/ssl.go          | 4 +++-
 pkg/apisix/stream_route.go | 4 +++-
 pkg/apisix/upstream.go     | 4 +++-
 5 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/pkg/apisix/global_rule.go b/pkg/apisix/global_rule.go
index 035c4b1..e2e9108 100644
--- a/pkg/apisix/global_rule.go
+++ b/pkg/apisix/global_rule.go
@@ -187,7 +187,9 @@ func (r *globalRuleClient) Delete(ctx context.Context, obj 
*v1.GlobalRule) error
        }
        if err := r.cluster.cache.DeleteGlobalRule(obj); err != nil {
                log.Errorf("failed to reflect global_rule delete to cache: %s", 
err)
-               return err
+               if err != cache.ErrNotFound {
+                       return err
+               }
        }
        return nil
 }
diff --git a/pkg/apisix/route.go b/pkg/apisix/route.go
index ae0dba1..e4c0ef2 100644
--- a/pkg/apisix/route.go
+++ b/pkg/apisix/route.go
@@ -189,7 +189,9 @@ func (r *routeClient) Delete(ctx context.Context, obj 
*v1.Route) error {
        }
        if err := r.cluster.cache.DeleteRoute(obj); err != nil {
                log.Errorf("failed to reflect route delete to cache: %s", err)
-               return err
+               if err != cache.ErrNotFound {
+                       return err
+               }
        }
        return nil
 }
diff --git a/pkg/apisix/ssl.go b/pkg/apisix/ssl.go
index a860842..16a9f7c 100644
--- a/pkg/apisix/ssl.go
+++ b/pkg/apisix/ssl.go
@@ -185,7 +185,9 @@ func (s *sslClient) Delete(ctx context.Context, obj 
*v1.Ssl) error {
        }
        if err := s.cluster.cache.DeleteSSL(obj); err != nil {
                log.Errorf("failed to reflect ssl delete to cache: %s", err)
-               return err
+               if err != cache.ErrNotFound {
+                       return err
+               }
        }
        return nil
 }
diff --git a/pkg/apisix/stream_route.go b/pkg/apisix/stream_route.go
index d46eda4..34ebe33 100644
--- a/pkg/apisix/stream_route.go
+++ b/pkg/apisix/stream_route.go
@@ -186,7 +186,9 @@ func (r *streamRouteClient) Delete(ctx context.Context, obj 
*v1.StreamRoute) err
        }
        if err := r.cluster.cache.DeleteStreamRoute(obj); err != nil {
                log.Errorf("failed to reflect stream_route delete to cache: 
%s", err)
-               return err
+               if err != cache.ErrNotFound {
+                       return err
+               }
        }
        return nil
 }
diff --git a/pkg/apisix/upstream.go b/pkg/apisix/upstream.go
index 06e634b..25cf18f 100644
--- a/pkg/apisix/upstream.go
+++ b/pkg/apisix/upstream.go
@@ -182,7 +182,9 @@ func (u *upstreamClient) Delete(ctx context.Context, obj 
*v1.Upstream) error {
        }
        if err := u.cluster.cache.DeleteUpstream(obj); err != nil {
                log.Errorf("failed to reflect upstream delete to cache: %s", 
err.Error())
-               return err
+               if err != cache.ErrNotFound {
+                       return err
+               }
        }
        return nil
 }

Reply via email to