Set a chunk limit to allow Roadrunner to stream responses to reduce memory consumption.

This commit is contained in:
Buster Neece 2024-04-15 06:04:43 -05:00
parent e2ba8d35b8
commit f28c472568
No known key found for this signature in database
1 changed files with 4 additions and 0 deletions

View File

@ -16,8 +16,12 @@ $diBuilder = AppFactory::createContainerBuilder($environment);
$httpFactory = new App\Http\HttpFactory();
$worker = \Spiral\RoadRunner\Worker::create();
$psr7Worker = new Spiral\RoadRunner\Http\PSR7Worker($worker, $httpFactory, $httpFactory, $httpFactory);
// Allow for streaming larger responses back to Roadrunner.
$psr7Worker->chunkSize = 1024 * 25;
while (true) {
try {
$request = $psr7Worker->waitRequest();