Remove timeout from provide context

This is being removed because it appears that the provide announcements
go out regardless of the timeout.

License: MIT
Signed-off-by: 's avatarMichael Avila <davidmichaelavila@gmail.com>
上级 a9b65346
...@@ -8,7 +8,6 @@ import ( ...@@ -8,7 +8,6 @@ import (
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
"github.com/libp2p/go-libp2p-routing" "github.com/libp2p/go-libp2p-routing"
"time"
) )
var ( var (
...@@ -17,7 +16,6 @@ var ( ...@@ -17,7 +16,6 @@ var (
const ( const (
provideOutgoingWorkerLimit = 8 provideOutgoingWorkerLimit = 8
provideOutgoingTimeout = 15 * time.Second
) )
// Provider announces blocks to the network, tracks which blocks are // Provider announces blocks to the network, tracks which blocks are
...@@ -75,14 +73,11 @@ func (p *Provider) handleAnnouncements() { ...@@ -75,14 +73,11 @@ func (p *Provider) handleAnnouncements() {
func doProvide(ctx context.Context, contentRouting routing.ContentRouting, key cid.Cid) error { func doProvide(ctx context.Context, contentRouting routing.ContentRouting, key cid.Cid) error {
// announce // announce
log.Info("announce - start - ", key) log.Info("announce - start - ", key)
ctx, cancel := context.WithTimeout(ctx, provideOutgoingTimeout)
if err := contentRouting.Provide(ctx, key, true); err != nil { if err := contentRouting.Provide(ctx, key, true); err != nil {
log.Warningf("Failed to provide cid: %s", err) log.Warningf("Failed to provide cid: %s", err)
// TODO: Maybe put these failures onto a failures queue? // TODO: Maybe put these failures onto a failures queue?
cancel()
return err return err
} }
cancel()
log.Info("announce - end - ", key) log.Info("announce - end - ", key)
return nil return nil
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论