Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Don't return errors on closed exchange #15

Merged
merged 1 commit into from
Jan 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions blockservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package blockservice
import (
"context"
"errors"
"fmt"
"io"
"sync"

Expand Down Expand Up @@ -150,8 +149,7 @@ func (s *blockService) AddBlock(o blocks.Block) error {
log.Event(context.TODO(), "BlockService.BlockAdded", c)

if err := s.exchange.HasBlock(o); err != nil {
// TODO(#4623): really an error?
return errors.New("blockservice is closed")
log.Errorf("HasBlock: %s", err.Error())
}

return nil
Expand Down Expand Up @@ -189,8 +187,7 @@ func (s *blockService) AddBlocks(bs []blocks.Block) error {
for _, o := range toput {
log.Event(context.TODO(), "BlockService.BlockAdded", o.Cid())
if err := s.exchange.HasBlock(o); err != nil {
// TODO(#4623): Should this really *return*?
return fmt.Errorf("blockservice is closed (%s)", err)
log.Errorf("HasBlock: %s", err.Error())
}
}
return nil
Expand Down