提交 7c00bcf3 作者: Jeromy Johnson 提交者: GitHub

Merge pull request #3192 from ipfs/fix/bitswap/too-many-findprovs

bitswap: search for wantlist providers a little less often
package bitswap
import (
"math/rand"
"sync"
"time"
......@@ -175,15 +176,14 @@ func (bs *Bitswap) rebroadcastWorker(parent context.Context) {
if len(entries) == 0 {
continue
}
tctx, cancel := context.WithTimeout(ctx, providerRequestTimeout)
for _, e := range bs.wm.wl.Entries() {
e := e
bs.findKeys <- &blockRequest{
Key: e.Key,
Ctx: tctx,
}
// TODO: come up with a better strategy for determining when to search
// for new providers for blocks.
i := rand.Intn(len(entries))
bs.findKeys <- &blockRequest{
Key: entries[i].Key,
Ctx: ctx,
}
cancel()
case <-parent.Done():
return
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论