Skip to content

Commit

Permalink
Ignore subscription cancelled warning (#7020)
Browse files Browse the repository at this point in the history
* Resolve TODO #6449
* Merge refs/heads/master into fix-6449
  • Loading branch information
prestonvanloon authored Aug 17, 2020
1 parent c3725d1 commit d66f729
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions beacon-chain/sync/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sync

import (
"context"
"errors"
"fmt"
"reflect"
"runtime/debug"
Expand All @@ -26,11 +25,6 @@ import (

const pubsubMessageTimeout = 30 * time.Second

var (
// TODO(6449): Replace this with pubsub.ErrSubscriptionCancelled.
errSubscriptionCancelled = errors.New("subscription cancelled by calling sub.Cancel()")
)

// subHandler represents handler for a given subscription.
type subHandler func(context.Context, proto.Message) error

Expand Down Expand Up @@ -151,7 +145,7 @@ func (s *Service) subscribeWithBase(base proto.Message, topic string, validator
msg, err := sub.Next(s.ctx)
if err != nil {
// This should only happen when the context is cancelled or subscription is cancelled.
if err != errSubscriptionCancelled { // Only log a warning on unexpected errors.
if err != pubsub.ErrSubscriptionCancelled { // Only log a warning on unexpected errors.
log.WithError(err).Warn("Subscription next failed")
}
return
Expand Down

0 comments on commit d66f729

Please sign in to comment.