Skip to content
Advertisement

Laravel controller function times out, 50000 users

In my controller I have a have a function to check subscription status and update it in my database. The problem is with 50000 users, it takes too long to finish and times out.

JavaScript

I’m sure I shouldn’t even process that many at a time but I kinda got stuck here and am not sure how exactly to approach this. My goal is to make this work and optimize it.

Advertisement

Answer

you use job like that:

JavaScript

in your env file change Queue_CONNECTiON=database, run php artisan queue:table and php artisan migrate in your checkSubscription file set that

JavaScript

in your controller:

JavaScript

then run php artisan queue:work

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement