This commit is contained in:
Joas Schilling 2026-02-03 19:57:38 -01:00 committed by GitHub
commit 958e668f8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 0 deletions

View file

@ -213,5 +213,10 @@ class App {
$io->setOutput($output);
}
}
if ($response->getFlushEarly()) {
ob_flush();
flush();
}
}
}

View file

@ -66,6 +66,7 @@ class Response {
/** @var bool */
private $throttled = false;
private bool $flushEarly = true;
/** @var array */
private $throttleMetadata = [];
@ -412,4 +413,25 @@ class Response {
public function isThrottled() {
return $this->throttled;
}
/**
* Request the response should be flushed to the connected client immediately
*
* @since 34.0.0
*/
public function setFlushEarly(bool $flushEarly): void {
$this->flushEarly = $flushEarly;
}
/**
* Whether the response should be flushed to the connected client immediately
*
* If not, the response will wait for async actions, e.g. HTTP requests from
* IClientService, to be finished before returning.
*
* @since 34.0.0
*/
public function getFlushEarly(): bool {
return $this->flushEarly;
}
}