Commit 803af901 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 8803a762
package bitswap package bitswap
import ( import (
"math/rand"
"sync" "sync"
"time" "time"
...@@ -175,15 +176,14 @@ func (bs *Bitswap) rebroadcastWorker(parent context.Context) { ...@@ -175,15 +176,14 @@ func (bs *Bitswap) rebroadcastWorker(parent context.Context) {
if len(entries) == 0 { if len(entries) == 0 {
continue continue
} }
tctx, cancel := context.WithTimeout(ctx, providerRequestTimeout)
for _, e := range bs.wm.wl.Entries() { // TODO: come up with a better strategy for determining when to search
e := e // for new providers for blocks.
bs.findKeys <- &blockRequest{ i := rand.Intn(len(entries))
Key: e.Key, bs.findKeys <- &blockRequest{
Ctx: tctx, Key: entries[i].Key,
} Ctx: ctx,
} }
cancel()
case <-parent.Done(): case <-parent.Done():
return 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