From: Matt Joiner Date: Fri, 23 May 2025 04:41:12 +0000 (+1000) Subject: Reorder spawn requests conditions X-Git-Tag: v1.59.0~121 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=6fb48f9f03cae9c7ea1b4cb988ecb45ee36db8ed;p=btrtrc.git Reorder spawn requests conditions Should just be faster --- diff --git a/webseed-peer.go b/webseed-peer.go index 89e7bf6c..ae91a91f 100644 --- a/webseed-peer.go +++ b/webseed-peer.go @@ -183,14 +183,14 @@ func (ws *webseedPeer) spawnRequests() { next, stop := iter.Pull(ws.inactiveRequests()) defer stop() for { - if len(ws.activeRequests) >= ws.client.MaxRequests { + if !ws.peer.t.cl.underWebSeedHttpRequestLimit() { break } - req, ok := next() - if !ok { + if ws.numRequests() >= ws.client.MaxRequests { break } - if !ws.peer.t.cl.underWebSeedHttpRequestLimit() { + req, ok := next() + if !ok { break } end := seqLast(ws.iterConsecutiveInactiveRequests(req)).Unwrap()