jeudi 21 février 2019

Return response to client before running event Laravel

Is there an less ugly way to do this:

ignore_user_abort(true);
set_time_limit(0);

ob_start();
echo $response; // send the response
header('Connection: close');
header('Content-Length: '.ob_get_length());
ob_end_flush();
ob_flush();
flush();

in Laravel? Basically i need the server to return response to user before running the events, I can't do this using queue because there's a lot of things that will be done, and a lot of clients simultaneously doing this action and those things need to be done instantly, so they can't be executed one by one. The events consist in sending mails, alerts, updating data on website tables, etc.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire