addRequestsBatched only caches the first batch, causing duplicate re-submissions (and excessive request queue writes) on densely-linked sites
Which package is this bug report for? If unsure which one to select, leave blank
None
Issue description
RequestQueue.addRequestsBatched() writes only the first batch into the local dedup cache (requestCache). Every subsequent batch is added with cache: false, so those requests are never remembered locally. When the same URLs are enqueued again later (e.g. enqueueLinks on a site where every page links to the same large set of pages), only the first batchSize (default 1000) are recognized as already-queued. The rest miss the cache and get re-submitted to the storage client on every call.
On PPU each re-submission is billed as a request queue write, even though the platform dedups server-side (so the queue and crawl stay correct). It also hammers the batchAddRequests rate limit, collapsing concurrency.
Proposed fix Cache the background batches too (don't force cache: false after the first chunk). requestCache is already size-bounded (requestCacheMaxSize, 1M/2M), so memory stays bounded.
Does this approach look acceptable? Happy to open a PR. Should it target master, or also v4? Feel free to reassign me to the issue once you make a decision on this.
Hello @nikitachapovskii-dev , I believe this is a duplicate of #3120. I'll close this issue in favour of the other one - but feel free to work on that :+1: The comments under the other issue describe a similar approach you're suggesting here (i.e., caching more requests).