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

nferraro pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 5520b63a06413751a48692515bce3220d29488ad
Author: nicolaferraro <ni.ferr...@gmail.com>
AuthorDate: Tue Jan 4 00:17:22 2022 +0100

    Fix #1107: simplify applier code
---
 pkg/client/apply.go | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/pkg/client/apply.go b/pkg/client/apply.go
index 50be4a7..cfcc2c6 100644
--- a/pkg/client/apply.go
+++ b/pkg/client/apply.go
@@ -50,8 +50,6 @@ func (c *defaultClient) ServerOrClientSideApplier() 
ServerOrClientSideApplier {
 func (a *ServerOrClientSideApplier) Apply(ctx context.Context, object 
ctrl.Object) error {
        once := false
        var err error
-       // nolint: ifshort
-       needsRetry := false
        a.tryServerSideApply.Do(func() {
                once = true
                if err = a.serverSideApply(ctx, object); err != nil {
@@ -59,17 +57,13 @@ func (a *ServerOrClientSideApplier) Apply(ctx 
context.Context, object ctrl.Objec
                                log.Info("Fallback to client-side apply for 
installing resources")
                                a.hasServerSideApply.Store(false)
                                err = nil
-                       } else {
-                               needsRetry = true
                        }
                } else {
                        a.hasServerSideApply.Store(true)
                }
        })
-       if needsRetry {
-               a.tryServerSideApply = sync.Once{}
-       }
        if err != nil {
+               a.tryServerSideApply = sync.Once{}
                return err
        }
        if v := a.hasServerSideApply.Load(); v.(bool) {

Reply via email to