main · 4 steps · about 8 s
DeployA deploy that reports its progress
Start it: the response is a pagelet that starts a poller. Every 2 s the poller asks for the progress, and the server stops it when the deploy is done.
Starts with the page, or with the pagelet whose content prints it.
The poller that sent the request, to control it from the response.
Called on the poller by the response.
Limits, and a pause while the user is away or the tab is hidden.
// The pagelet of the deploy starts the poller with itself
(new Poller(route('deploy.status'), 2000))
->setMaxRequests(20)
->start();
// The endpoint of the poller
$response = (new AsyncResponse())
->setContent('#deploy-progress', view('progress', compact('progress'))->render());
if ($progress >= 100) {
$response->call(Poller::requestedId(), 'stop');
}
return $response->send();
main · 4 steps · about 8 s
DeployStart it: the response is a pagelet that starts a poller. Every 2 s the poller asks for the progress, and the server stops it when the deploy is done.