Skip to content

Commit

Permalink
refactor(share/availability): don't log error canceled operation (cel…
Browse files Browse the repository at this point in the history
…estiaorg#2475)

Small cleanup to prevent node from spamming error availability logs on
shutdown.

---------

Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
  • Loading branch information
walldiss and renaynay authored Jul 14, 2023
1 parent 05e00e8 commit b59c21c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions share/availability/full/availability.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ func (fa *ShareAvailability) SharesAvailable(ctx context.Context, root *share.Ro

_, err := fa.getter.GetEDS(ctx, root)
if err != nil {
if errors.Is(err, context.Canceled) {
return err
}
log.Errorw("availability validation failed", "root", root.String(), "err", err.Error())
var byzantineErr *byzantine.ErrByzantine
if ipldFormat.IsNotFound(err) || errors.Is(err, context.DeadlineExceeded) && !errors.As(err, &byzantineErr) {
return share.ErrNotAvailable
}

return err
}
return err
}
Expand Down
6 changes: 3 additions & 3 deletions share/availability/light/availability.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ func (la *ShareAvailability) SharesAvailable(ctx context.Context, dah *share.Roo
}

if err != nil {
if !errors.Is(err, context.Canceled) {
log.Errorw("availability validation failed", "root", dah.String(), "err", err.Error())
if errors.Is(err, context.Canceled) {
return err
}
log.Errorw("availability validation failed", "root", dah.String(), "err", err.Error())
if ipldFormat.IsNotFound(err) || errors.Is(err, context.DeadlineExceeded) {
return share.ErrNotAvailable
}

return err
}
}
Expand Down

0 comments on commit b59c21c

Please sign in to comment.