Commit 5575419b authored by Jeromy's avatar Jeromy

bitswap: search for wantlist providers a little less often

License: MIT
Signed-off-by: default avatarJeromy <why@ipfs.io>
parent b78786db
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 is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment