Running on Laravel 5.8 I am creating a large number of Jobs which I believe should be executed once the queue has been initiated. My issue is that the jobs get executed then and there when I haven't even started the queue.
They are not even being inserted in to the jobs
table created by the migration.
Below are the settings and the piece of code I believe is relevant. Please let me know if more info is needed.
On a fresh installation:
php artisan queue:table
php artisan migrate
.env file
QUEUE_CONNECTION=database
Created the queuedtask
class FulfillmentTask implements ShouldQueue{
//code here
}
Controller
use App\Jobs\FulfillmentTask;
//rest of the class here
public function somefunction(Request $request){
//some code here
//read csv file
foreach ($fileContents as $row){
FulfillmentTask::dispatch($orderId, $client, $request->sendEmail)->onQueue('database');
}
}
Issue is the FulfillmentTask is executed without the queue:work
command being given in the terminal.
Any idea on why this is happening?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire