0

Currently I have a cron running that calls a command and adds this job to my queue. This works normally up to a point, then the job runs but doesn't add anything to the queue, so I have to log into the server and give an artisan config:clear to get everything running again. Does anyone have an idea what it could be? I'm using forge to perform server deployments and management, my queue is using redis driver, laravel 9, horizon and octane, php 8.1, mysql

Just to be clear: my problem is not happening while running the jobs, when the job arrives in the queue the horizon is processing perfect. the biggest problem is when adding item to the queue, that when cron goes to run, all of a sudden it doesn't find the settings of which queue it should use anymore and doesn't add anything to the queue :(

Example of command running using crontab:


namespace App\Console\Commands;

use App\Jobs\MyJob;
use Illuminate\Console\Command;

class MyCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'cron:myCommand';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        MyJob::dispatch()->onQueue('my_queue');
        
        return Command::SUCCESS;
    }
}
  • Check if any other service changes your laravel.log/cache/view files permissions. It happened to me that laravel methods were writing and changing file permissions, therefore on further attempts from workers failed. – Luciano May 31 '22 at 19:05
  • Nope, also i store everything about cache, queue etc in redis. – Dilnei Soethe Spancerski Jun 01 '22 at 03:42
  • It's quite difficult to debug this without any code or server resources log, but you could check memory leaks. Also, Redis has an internal timeout for connections which in Laravel is defined in the queue.php under the retry_after key. Try changing that value for testing purposes – Luciano Jun 01 '22 at 10:50
  • @Luciano I don't know if you understand the initial problem here. my problem is not happening while running the jobs, when the job arrives in the queue the horizon is processing perfect. the biggest problem is when adding item to the queue, that when cron goes to run, all of a sudden it doesn't find the settings of which queue it should use anymore and doesn't add anything to the queue :( – Dilnei Soethe Spancerski Jun 01 '22 at 12:04

0 Answers0