Skip to content

Commit

Permalink
fix: don't report that we retry context canceled
Browse files Browse the repository at this point in the history
It suppresses logging and returns a bit earlier (mostly cosmetic fix).

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Jan 17, 2025
1 parent badee96 commit a622beb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/state/protobuf/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func (adapter *Adapter) WatchKindAggregated(ctx context.Context, resourceKind re
return nil
}

//nolint:gocognit,gocyclo,cyclop
//nolint:gocognit,gocyclo,cyclop,maintidx
func (adapter *Adapter) watchAdapter(
ctx context.Context,
cli v1alpha1.State_WatchClient,
Expand Down Expand Up @@ -513,6 +513,12 @@ func (adapter *Adapter) watchAdapter(
for {
// retry loop - at the beginning of the loop 'err' is the error to be retried,
// lastBookmark is the last seen bookmark
//
// quick check for context canceled, no need to retry
if err = ctx.Err(); err != nil {
return nil, err
}

delay := backoff.NextBackOff()
if delay == backoff.Stop {
return nil, fmt.Errorf("maximum retry attempts: %w", err)
Expand Down

0 comments on commit a622beb

Please sign in to comment.