Skip to content

Commit

Permalink
fix(reconciler): requeue scope access errors manually to avoid spammi…
Browse files Browse the repository at this point in the history
…ng API
  • Loading branch information
tronghn committed Oct 24, 2024
1 parent e7b8969 commit e22facd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/common/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net/http"
"strings"
"time"

"github.com/go-jose/go-jose/v4"
naisiov1 "github.com/nais/liberator/pkg/apis/nais.io/v1"
Expand Down Expand Up @@ -82,6 +83,10 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request, instance c
if err := r.observeError(tx, err); err != nil {
return ctrl.Result{}, fmt.Errorf("observing error: %w", err)
}
if errors.Is(err, digdir.ClientError) {
// Requeue client errors after a longer period of time to avoid spamming the API
return ctrl.Result{RequeueAfter: 1 * time.Hour}, nil
}
return ctrl.Result{}, fmt.Errorf("processing: %w", err)
}

Expand Down

0 comments on commit e22facd

Please sign in to comment.