Skip to content

Commit 1c4fe39

Browse files
author
ScottyPoi
committed
ContentLookup: limit concurrent requests to 5
1 parent 32c278b commit 1c4fe39

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/portalnetwork/src/networks/contentLookup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ export class ContentLookup {
8686
if (this.lookupPeers.length > 0) {
8787
// Ask more peers (up to 5) for content
8888
const peerBatch: LookupPeer[] = []
89-
while (this.lookupPeers.peek() && peerBatch.length < 5) {
89+
const availableSlots = 5 - this.pending.size
90+
while (this.lookupPeers.peek() && peerBatch.length < availableSlots) {
9091
const next = this.lookupPeers.pop()!
9192
peerBatch.push(next)
9293
}

0 commit comments

Comments
 (0)