Skip to content

Commit c9008a0

Browse files
committed
document max concurrency on request pools and batches
1 parent d34671e commit c9008a0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

http-client.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,14 @@ $responses = Http::pool(fn (Pool $pool) => [
537537
return $responses['first']->ok();
538538
```
539539

540+
The maximum concurrency of the request pool may be controlled by providing the `concurrency` argument to the `pool` method. This value determines the maximum number of HTTP requests that may be concurrently in-flight while processing the request pool:
541+
542+
```php
543+
$responses = Http::pool(fn (Pool $pool) => [
544+
// ...
545+
], concurrency: 5);
546+
```
547+
540548
<a name="customizing-concurrent-requests"></a>
541549
#### Customizing Concurrent Requests
542550

@@ -598,6 +606,14 @@ $responses = Http::batch(fn (Batch $batch) => [
598606

599607
After a `batch` is started by calling the `send` method, you can't add new requests to it. Trying to do so will result in a `Illuminate\Http\Client\BatchInProgressException` exception being thrown.
600608

609+
The maximum concurrency of the request batch may be controlled via the `concurrency` method. This value determines the maximum number of HTTP requests that may be concurrently in-flight while processing the request batch:
610+
611+
```php
612+
$responses = Http::batch(fn (Batch $batch) => [
613+
// ...
614+
])->concurrency(5)->send();
615+
```
616+
601617
<a name="inspecting-batches"></a>
602618
#### Inspecting Batches
603619

0 commit comments

Comments
 (0)