Problem/Motivation
The CDN warmer code has the following statement for limiting concurrent requests:
$item_keys = array_keys($items);
if ($key % $max_concurrent_requests == 0 || $key == end($item_keys)) {
\GuzzleHttp\Promise\all($promises)->wait();
$promises = [];
}
However, if the $key is 0 (i.e. first URL in the list), the $key % $max_concurrent_requests == 0 expression is always TRUE.
As a result, it's always waiting for the first URL in the list to be fetched before proceeding with the rest of the batch (which could be then fetched concurrently as expected).
Proposed resolution
Patch attached.
Remaining tasks
Review and merge.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | warmer-3272428-2.patch | 1.6 KB | abramm |
Comments
Comment #2
abrammComment #3
e0ipsoThanks for the patch! This looks good from a static perspective.