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.

CommentFileSizeAuthor
#2 warmer-3272428-2.patch1.6 KBabramm

Comments

abramm created an issue. See original summary.

abramm’s picture

Status: Active » Needs review
StatusFileSize
new1.6 KB
e0ipso’s picture

Status: Needs review » Fixed

Thanks for the patch! This looks good from a static perspective.

  • e0ipso committed 8e02edb on 2.x authored by abramm
    Issue #3272428 by abramm, e0ipso: CDN Warmer always waits for the first...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.