Skip to content

Commit

Permalink
Remove failures queue
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelavila committed Jan 22, 2019
1 parent 864024d commit 126924a
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

1 comment on commit 126924a

@GitCop
Copy link

@GitCop GitCop commented on 126924a Jan 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

Please sign in to comment.