Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/private/AppFramework/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,10 @@ public static function main(
$io->setOutput($output);
}
}

if ($response->getFlushEarly()) {
ob_flush();
flush();
}
}
}
22 changes: 22 additions & 0 deletions lib/public/AppFramework/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Response {

/** @var bool */
private $throttled = false;
private bool $flushEarly = true;
/** @var array */
private $throttleMetadata = [];

Expand Down Expand Up @@ -412,4 +413,25 @@ public function getThrottleMetadata() {
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;
}
}
Loading