我有一个laravel项目,该项目已经运行了好几个星期,并且每5分钟运行一次计划的作业,没有问题。我可以看到该作业正在Horizon中运行,如果我使用php artisan queue:work --tries=3
,也可以看到该作业正在运行。仅供参考-我将Redis用于队列驱动程序。
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
作业。
我尝试了以下方法:
作为测试,我还尝试通过注释掉$schedule->job(new FetchMajorProblems)->everyFiveMinutes();
来删除当前作业。问题是,即使已将其注释掉,该作业仍每5分钟运行一次!
我想不出什么办法检查作业可能被缓存在哪里。