Skip to content

Commit

Permalink
chore: modify all error contrast judgments by errors (#2491)
Browse files Browse the repository at this point in the history
Fix all error contrast judgments by errors

Signed-off-by: Fish-pro <zechun.chen@daocloud.io>

Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
  • Loading branch information
Fish-pro and ritazh authored Jan 5, 2023
1 parent 0fc6306 commit a21f595
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/watch/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package watch

import (
"context"
"errors"
"fmt"
"sync"

Expand Down Expand Up @@ -190,19 +191,19 @@ func (wm *Manager) replayEventsLoop(ctx context.Context) func() error {

err := wait.ExponentialBackoff(retry.DefaultBackoff, func() (bool, error) {
err := wm.replayEvents(childCtx, req.r, req.gvk)
if err != nil && err != context.Canceled {
if err != nil && !errors.Is(err, context.Canceled) {
// Log and retry w/ backoff
log.Error(err, "replaying events")
return false, nil
}
if err == context.Canceled {
if errors.Is(err, context.Canceled) {
// Give up
return false, err
}
// Success
return true, nil
})
if err != nil && err != context.Canceled {
if err != nil && !errors.Is(err, context.Canceled) {
log.Error(err, "replaying events")
}
}(&wg, childCancel, log)
Expand Down

0 comments on commit a21f595

Please sign in to comment.