Laravel队列无法从Kernel.php中读取更新

时间:2019-01-18 09:51:55

标签: laravel queue horizon

背景

我有一个laravel项目,该项目已经运行了好几个星期,并且每5分钟运行一次计划的作业,没有问题。我可以看到该作业正在Horizo​​n中运行,如果我使用php artisan queue:work --tries=3,也可以看到该作业正在运行。仅供参考-我将Redis用于队列驱动程序。

正在运行的Kernel.php

namespace App\Console;

use Artisan;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Jobs\FetchMajorProblems;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
        'App\Console\Commands\MassAssignRole',
        'App\Console\Commands\ClearLogs',
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {

       $schedule->command('horizon:snapshot')->everyFiveMinutes();

       $schedule->job(new FetchMajorProblems)->everyFiveMinutes();

    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
    }
}

问题

我现在已经以与FetchMajorProblems完全相同的方式创建了新工作。现在,我还通过以下2个更改将其添加到Kernel.php文件中;

  • 在顶部添加了use App\Jobs\FetchMajorIncidents;
  • $schedule->job(new FetchMajorIncidents)->everyFiveMinutes();添加到计划功能。

但是,没有调用新的FetchMajorIncidents作业。

我尝试过的

我尝试了以下方法:

  • 重新开始地平线
  • 重新启动服务器
  • 清除了PHP缓存
  • 清除了php配置
  • 清除了php视图
  • Ran Composer转储-自动加载

作为测试,我还尝试通过注释掉$schedule->job(new FetchMajorProblems)->everyFiveMinutes();来删除当前作业。问题是,即使已将其注释掉,该作业仍每5分钟运行一次!

我想不出什么办法检查作业可能被缓存在哪里。

0 个答案:

没有答案