Commit 5da9c5e7 authored by Jeromy's avatar Jeromy

early out if no entries in wantlist

parent 09a1db4c
......@@ -225,6 +225,12 @@ func (bs *bitswap) sendWantlistToPeers(ctx context.Context, peers <-chan peer.ID
}
func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
entries := bs.wantlist.Entries()
if len(entries) == 0 {
log.Debug("No entries in wantlist, skipping send routine.")
return
}
log := log.Prefix("bitswap(%s).sendWantlistToProviders ", bs.self)
log.Debugf("begin")
defer log.Debugf("end")
......@@ -237,7 +243,7 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
// Get providers for all entries in wantlist (could take a while)
wg := sync.WaitGroup{}
for _, e := range bs.wantlist.Entries() {
for _, e := range entries {
wg.Add(1)
go func(k u.Key) {
defer wg.Done()
......
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