Reputation: 7
I am facing an issue in my laravel (v-8) application. There are 10+ jobs to generate Excel files and send them to different email addresses. Everything works fine, but only one job is taking too long to execute. Then, php artisan queue:work
stopped for this.
How can I fix it? Please help me.
I have set the php.ini file with max_execution_time=600
and assigned memory_limit=4G
, but this problem persists.
Upvotes: 0
Views: 223
Reputation: 76943
You will need to find out whether the job to be executed can be optimized. If it can, then do so.
After you exhausted all the means to optimize it that you know about, you will end up deciding whether it's still slow or not. If it's no longer slow, then the problem is solved. If it's still slow, then you will need to think about this. Perhaps execute it less frequently and in an asynchronous manner, that is, you would have a job that would only trigger this one to be executed without waiting for the response of this event. Then your scheduled job mechanism would be working well with this job being only scheduled to be executed and to be run more rarely.
It's also possible that this job depends on other jobs or some other things and it's in a waiting state for a while. If so, then you definitely need to trigger it asynchronously. You said it works if you run it individually. So you need your system to do it like you did, but without the entire system waiting for its slow results.
Upvotes: 0