samedi 24 octobre 2020

how to deal with long task on laravel to avoid 504 error?

I'm trying to do a long task (upload file or foreach 100k rows query) but every time I get the 504 error.

I have set nginx.conf, ini_set('max_execution_time', 300); and the set_time_limit(0) but nothing seems to work.

What is the proper way to deal with long tasks, I mean, is there a way to send responses while doing the job? so the server and client keep communicating? so both parties know that the job isn't done yet?

For example, I know the query have 100k rows, so I know is a long job. Or uploading a large file, I send chunks of it, knowing theres a lot of chunks, but keep getting the 504 error.

Should I send responses for each loop? How can I do that? returning responses ends the job, so I don't know how to keep the task alive



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire