Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EachPromise.php

function EachPromise::refillPending

2 calls to EachPromise::refillPending()
EachPromise::promise in vendor/guzzlehttp/promises/src/EachPromise.php
@psalm-suppress InvalidNullableReturnType
EachPromise::step in vendor/guzzlehttp/promises/src/EachPromise.php

File

vendor/guzzlehttp/promises/src/EachPromise.php, line 126

Class

EachPromise
Represents a promise that iterates over many promises and invokes side-effect functions in the process.

Namespace

GuzzleHttp\Promise

Code

private function refillPending() : void {
    if (!$this->concurrency) {
        // Add all pending promises.
        while ($this->addPending() && $this->advanceIterator()) {
        }
        return;
    }
    // Add only up to N pending promises.
    $concurrency = is_callable($this->concurrency) ? ($this->concurrency)(count($this->pending)) : $this->concurrency;
    $concurrency = max($concurrency - count($this->pending), 0);
    // Concurrency may be set to 0 to disallow new promises.
    if (!$concurrency) {
        return;
    }
    // Add the first pending promise.
    $this->addPending();
    // Note this is special handling for concurrency=1 so that we do
    // not advance the iterator after adding the first promise. This
    // helps work around issues with generators that might not have the
    // next value to yield until promise callbacks are called.
    while (--$concurrency && $this->advanceIterator() && $this->addPending()) {
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal