laravel - Laravel 队列未从 Kernel.php 读取更新
问题描述
背景
我有一个 laravel 项目,现在已经运行了好几个星期,并且每 5 分钟运行一次预定的作业,没有问题。我可以看到该作业正在 Horizon 中运行,如果我使用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 分钟运行一次!
我想不出其他任何东西来检查作业可能被缓存的位置。
解决方案
推荐阅读
- javascript - 使用带有 ajax 的 select2 并没有在下拉列表中显示数据,即使我也无法选择任何数据
- java - 设置 Excel 工作表背景图片
- processing - 玩家无法在瓷砖上重踩的网格拼图 - 处理
- android - 如何传递TYPE_APPLICATION_OVERLAY下的点击事件
- android - 多个 API 和 XML 资源
- php - Symfony 3.4 项目:OVH 服务器上的发布问题
- python - 如何在文本“.html”之前提取一串数字?
- c# - WPF 从视图类中获取 RegionName
- python - 将文本转换为转置的数据帧,同时保留文件名(python 中的熊猫)
- python - 代码在十位和数百位处不适用于奇数