Laravel queue delay problem

< H1 > Controller < / H1 >
<?php

namespace App\Jobs;

use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Log;

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

    protected $user;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct(User $user)
    {
        $this->user = $user;
        //
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        //
        Log::info(",", ["id" => $this->user->id, "name" => $this->user->name]);
    }

    public function fail($exception = null)
    {

    }
}

I set the trigger queue in the controller when the request comes. It seems to me that delay should be delayed, and then I set it to execute in 30 seconds, so when I request to play, I immediately check the log and the data is output to laravel.log, instead of 30 seconds later. Database queue used


this depends on the value of QUEUE_DRIVER in your .env file. If it is sync , then delay execution is invalid. It is executed immediately. If asynchronous delay is needed, it needs to be modified to one of database , beanstalkd , sqs , redis . After modification, you also need to start task monitoring.

php artisan queue:listen
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31f0d-2bddc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31f0d-2bddc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?