I'm trying to work a Laravel Job which must return a response immediately and execute itself in the background.
It was working fine but I don't know what went wrong because now it is not working (I just edited tried to send Notification to a user responsible for sending email updates to other users)!
I am using sync
driver because I don't want to execute php artisan queue:work
command every time I put something in the queue. Here is the code! In my .env
file and config/queue.php
file, I've set the driver to sync
.
** I am trying to send E-mails to user which takes time **
Click here to see the code executed in UserController, App\Mail\EmailUpdate and App\Jobs\SendEmailUpdates.
At first (When it was working), I was being redirected back immediately! But after some time (I think 15 minutes), it is taking about 15-20 seconds to redirect me back! It is acting like a normal PHP code and sending E-mails to users before redirecting me back!
I tried resetting the code but it didn't work! Any help would be appreciated!