Pool
class Pool
Properties
| protected Request>|Request> | $requests | The requests or request producer. |
|
| protected null|Response, array-key): void | $responseHandler | The successful response handler. |
|
| protected null|Throwable, array-key): void | $exceptionHandler | The request exception handler. |
Methods
Create a request pool.
Set the pool requests.
Get the configured requests.
Set the maximum number of concurrent requests.
Register a successful response handler.
Register a request exception handler.
Send every request and collect successful responses.
Process every request without retaining successful responses.
Execute the pool in the current or a new root coroutine.
Schedule the requests and settle every started child.
Rebuild results in input order using normal PHP key semantics.
Details
at line 49
__construct(Connector $connector, iterable|callable $requests = [], int $concurrency = 5, callable|null $responseHandler = null, callable|null $exceptionHandler = null)
Create a request pool.
at line 74
Pool
setRequests(iterable|callable $requests)
Set the pool requests.
at line 86
iterable
requests()
Get the configured requests.
at line 98
Pool
setConcurrency(int $concurrency)
Set the maximum number of concurrent requests.
at line 115
Pool
withResponseHandler(callable $handler)
Register a successful response handler.
at line 128
Pool
withExceptionHandler(callable $handler)
Register a request exception handler.
at line 140
array
send()
Send every request and collect successful responses.
at line 148
void
process()
Process every request without retaining successful responses.
at line 158
protected array
execute(bool $collectResponses)
Execute the pool in the current or a new root coroutine.
at line 187
protected array
orchestrate(bool $collectResponses)
Schedule the requests and settle every started child.
at line 291
protected array
keyResults(array $results)
Rebuild results in input order using normal PHP key semantics.