samedi 21 mai 2022

Job which implements ShouldQueue does not write to database

I'm trying to implement the basic queue in Laravel 5.7.

I have run the migration which creates the jobs and failed_jobs tables.

I have updated the .env to QUEUE_CONNECTION=database and QUEUE_DRIVER=database

I have created a basic Job with artisan

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class NewJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        sleep(5);
    }
}

I'm calling the NewJob in a Controller.

       NewJob::dispatch();

I have run the following artisan commands

php artisan config:cache
php artisan cache:clear
php artisan queue:flush

I'm not looking for the queue to execute because the Job isn't writing to the database.

There is no errors in the Larravel.log neither are there any files in /var/log/* that have been modified that I can tail.

I dont know where to look or what to change. I have redone this implementation by redoing the migrations and a new Job called in another controller and I still dont get any data being written to the database.

I'm using Mariadb(InnoDB) on a Debian server.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/emt7lN9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire