Cron 循环内的laravel调度程序
当我运行下面的代码处理用户id 1,2,3,4,5时,我对laravel排队作业感到困惑,但当它在1分钟标记后运行时,它将尝试再次运行用户id 1,2,3,4,5,而不是继续执行6,7,8,9,10。我想连续运行它,直到它通过所有用户完成为止(这意味着我不知道它何时会通过所有用户完成)。我该怎么办 应用程序/控制台/内核Cron 循环内的laravel调度程序,cron,laravel-queue,laravel-scheduler,Cron,Laravel Queue,Laravel Scheduler,当我运行下面的代码处理用户id 1,2,3,4,5时,我对laravel排队作业感到困惑,但当它在1分钟标记后运行时,它将尝试再次运行用户id 1,2,3,4,5,而不是继续执行6,7,8,9,10。我想连续运行它,直到它通过所有用户完成为止(这意味着我不知道它何时会通过所有用户完成)。我该怎么办 应用程序/控制台/内核 <?php namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illumi
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\User;
use Illuminate\Support\Facades\File;
use App\Exceptions\Handler;
use App\Jobs\UserJob;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$users = User::where('is_status', 1)->get();
foreach( $users as $user ){
$schedule->job( new UserJob($user) )->everyMinute();
}
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1