From b044e767f42dd68fb8701f5baf000f215dc11116 Mon Sep 17 00:00:00 2001 From: Illia Sakovich Date: Thu, 1 Oct 2020 13:17:36 +0300 Subject: [PATCH 1/4] schedule worker --- .../Scheduling/ScheduleWorkCommand.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php diff --git a/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php b/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php new file mode 100644 index 000000000000..789b12df1929 --- /dev/null +++ b/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php @@ -0,0 +1,40 @@ +info('Schedule worker started successfully.'); + + while (true) { + if (now()->second === 0) { + $this->call('schedule:run'); + } + + sleep(1); + } + } +} From 98bc589a45eb5ff86165325bfce5c5f1534c0468 Mon Sep 17 00:00:00 2001 From: Illia Sakovich Date: Thu, 1 Oct 2020 15:28:33 +0300 Subject: [PATCH 2/4] wip --- src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php b/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php index 789b12df1929..80343abbc260 100644 --- a/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php +++ b/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php @@ -2,6 +2,7 @@ namespace Illuminate\Console\Scheduling; +use Illuminate\Support\Carbon; use Illuminate\Console\Command; class ScheduleWorkCommand extends Command @@ -30,7 +31,7 @@ public function handle() $this->info('Schedule worker started successfully.'); while (true) { - if (now()->second === 0) { + if (Carbon::now()->second === 0) { $this->call('schedule:run'); } From 4c208a48d0bc6d86b57bd435ec4d082e0b75cf29 Mon Sep 17 00:00:00 2001 From: Illia Sakovich Date: Thu, 1 Oct 2020 15:32:28 +0300 Subject: [PATCH 3/4] wip --- src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php b/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php index 80343abbc260..d1f33ab29f8f 100644 --- a/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php +++ b/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php @@ -2,8 +2,8 @@ namespace Illuminate\Console\Scheduling; -use Illuminate\Support\Carbon; use Illuminate\Console\Command; +use Illuminate\Support\Carbon; class ScheduleWorkCommand extends Command { From dc8094f73e3b5150e0b2035fd7279cefddf731c3 Mon Sep 17 00:00:00 2001 From: Illia Sakovich Date: Thu, 1 Oct 2020 15:53:00 +0300 Subject: [PATCH 4/4] wip --- .../Foundation/Providers/ArtisanServiceProvider.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php index bc17f9c1bc79..d48bbfd72c9c 100755 --- a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php @@ -8,6 +8,7 @@ use Illuminate\Cache\Console\ForgetCommand as CacheForgetCommand; use Illuminate\Console\Scheduling\ScheduleFinishCommand; use Illuminate\Console\Scheduling\ScheduleRunCommand; +use Illuminate\Console\Scheduling\ScheduleWorkCommand; use Illuminate\Contracts\Support\DeferrableProvider; use Illuminate\Database\Console\DumpCommand; use Illuminate\Database\Console\Factories\FactoryMakeCommand; @@ -113,6 +114,7 @@ class ArtisanServiceProvider extends ServiceProvider implements DeferrableProvid 'Seed' => 'command.seed', 'ScheduleFinish' => ScheduleFinishCommand::class, 'ScheduleRun' => ScheduleRunCommand::class, + 'ScheduleWork' => ScheduleWorkCommand::class, 'StorageLink' => 'command.storage.link', 'Up' => 'command.up', 'ViewCache' => 'command.view.cache', @@ -914,6 +916,16 @@ protected function registerScheduleRunCommand() $this->app->singleton(ScheduleRunCommand::class); } + /** + * Register the command. + * + * @return void + */ + protected function registerScheduleWorkCommand() + { + $this->app->singleton(ScheduleWorkCommand::class); + } + /** * Register the command. *