0
votes

I am trying to add queue system to my Laravel app (local development). I have set these two paramaters in each file :
queue.php -> 'default' => env('QUEUE_DRIVER', 'database')
.env -> QUEUE_DRIVER=database

I have created an migrated my two table jobs and failed_jobs in my Database.

I have launched the queue system with "php artisan queue:work".

And I'm now trying to send mail via queue system with for example :
"Mail::to($email)->queue(new PasswordUpdatedMail($name));"

The mail is sent but never by the queue system, it's always sent with sync because the next automatic index is always "1" and when i place a sleep timer in the build function of my PasswordUpdatedMail, the broswer is waiting for the timer and after the mail is sent, the broswer write the success message.

So my mail skip the Queue System... I have looked for tutorials and forums but i don't find answer to my problem.

Thank's for your help !

1
Do other queueing tasks work (like queued jobs or queued event listeners)? And do you by any chance used the php artisan config:cache command? If so, changes to your config will not be picked up until you run the command again. You can clear the config cache with php artisan config:clear. - Namoshek
Thank's a lot Namoshek ! It was the config cache... So okay, if i update the env file i have to clear the config cache ! It's noted. - Clément Hanquiez
Yes, but also if you just change the normal config. What caching the config does, is, pulling all your config files together, evaluation any functions in it, and storing the result in a single file. And if this cached file exists, none of the other config files will be loaded by the framework. This is done to reduce the amount of loaded files during execution, which improves performance. - Namoshek
Okay i understand, thank you for you explanations :) - Clément Hanquiez

1 Answers

0
votes

Namoshek has found the solution. Just need to do "php artisan config:cache" after updated the .env file ! Thank's !