Skip to content

Commit

Permalink
Remove failures queue
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Michael Avila <davidmichaelavila@gmail.com>
  • Loading branch information
michaelavila committed Jan 22, 2019
1 parent 864024d commit d5f8cf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 1 addition & 5 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,7 @@ func (n *IpfsNode) startLateOnlineServices(ctx context.Context) error {
if err != nil {
return err
}
failures, err := provider.NewQueue("provider-failures", n.Repo.Datastore())
if err != nil {
return err
}
n.Provider = provider.NewProvider(ctx, strategy, tracker, queue, failures, n.Routing)
n.Provider = provider.NewProvider(ctx, strategy, tracker, queue, n.Routing)
go n.Provider.Run()

// Reprovider
Expand Down
9 changes: 2 additions & 7 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,16 @@ type Provider struct {
tracker *Tracker
// the CIDs for which provide announcements should be made
queue *Queue
// cids that fail during announce()
// TODO: handle these ... right now this queue grows indefinitely
failures *Queue
// used to announce providing to the network
contentRouting routing.ContentRouting
}

func NewProvider(ctx context.Context, strategy Strategy, tracker *Tracker, queue *Queue, failures *Queue, contentRouting routing.ContentRouting) *Provider {
func NewProvider(ctx context.Context, strategy Strategy, tracker *Tracker, queue *Queue, contentRouting routing.ContentRouting) *Provider {
return &Provider{
ctx: ctx,
strategy: strategy,
tracker: tracker,
queue: queue,
failures: failures,
contentRouting: contentRouting,
lock: sync.Mutex{},
}
Expand Down Expand Up @@ -131,8 +127,7 @@ func (p *Provider) handleAnnouncements() {

if err := p.announce(entry.cid); err != nil {
log.Warningf("Unable to announce providing: %s, %s", entry.cid, err)
// maybe the cid + err should go on the queue?
p.failures.Enqueue(entry.cid)
// TODO: Maybe put these failures onto a failures queue?
if err := entry.Complete(); err != nil {
log.Warningf("Unable to complete queue entry for failure: %s, %s", entry.cid, err)
continue
Expand Down

0 comments on commit d5f8cf3

Please sign in to comment.