简体   繁体   English

Laravel Scheduler没有运行命令

[英]Laravel Scheduler not running commands

I have these commands scheduled in my Kernel.php inside app/Console/ 我在app / Console /里面的Kernel.php中安排了这些命令

protected function schedule(Schedule $schedule)
{
    $schedule->command('inspire')->everyMinute();
    $schedule->command("trustpilot:send")->everyMinute();
    $schedule->command("run:status")->everyFiveMinutes();

}

When i run php artisan schedule:run i get this message : 当我运行php artisan时间表:运行我收到此消息:

No scheduled commands are ready to run. 没有计划的命令准备好运行。

It is strange because if i'm dumping $schedule->dueEvents($this->app) i get a list with the events inspire and trustpilot:send . 这很奇怪,因为如果我正在倾销$ schedule-> dueEvents($ this-> app),我会得到一个包含事件激励信任的列表:发送

I've tried to dump the list of dueEvents in /vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php but here the list is empty?? 我试图在/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php中转储dueEvents列表,但这里列表是空的?

/**
 * Execute the console command.
 *
 * @return void
 */
public function handle()
{
    dd($this->schedule->dueEvents($this->laravel)); <---- EMPTY?
    foreach ($this->schedule->dueEvents($this->laravel) as $event) {

        if (! $event->filtersPass($this->laravel)) {
            continue;
        }
.....

Has anyone experienced this before? 有谁之前经历过这个吗?

I got it! 我知道了!

In boot command of my application i ran this: 在我的应用程序的启动命令中我运行了这个:

Artisan::call('....');

It overrides the old schedueler instance and thats why the dueEvent list was empty. 它会覆盖旧的schedueler实例,这就是为什么dueEvent列表为空。

I removed the line and then i works :) 我删除了线,然后我工作:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM