Skip to content

Commit c0b0be4

Browse files
committed
fix: replace manager references with ExecutorFacade for consistency
1 parent 246e569 commit c0b0be4

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/Classes/ExecutorManager.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ExecutorManager
1111
*
1212
* @var ExecutorPool
1313
*/
14-
public ExecutorPool $pool;
14+
protected ExecutorPool $pool;
1515

1616
/**
1717
* The server IPs.
@@ -25,6 +25,16 @@ public function __construct()
2525
$this->pool = new ExecutorPool();
2626
}
2727

28+
/**
29+
* Get the executor pool instance.
30+
*
31+
* @return ExecutorPool
32+
*/
33+
public function getPool()
34+
{
35+
return $this->pool;
36+
}
37+
2838
/**
2939
* Get all executor records.
3040
*

src/Console/ExecuteCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Pharaonic\Laravel\Executor\Console;
44

55
use Illuminate\Console\Command;
6+
use Pharaonic\Laravel\Executor\Facades\Executor as ExecutorFacade;
67

78
class ExecuteCommand extends Command
89
{
@@ -26,8 +27,9 @@ class ExecuteCommand extends Command
2627
*/
2728
public function handle()
2829
{
29-
$manager = app('pharaonic.executor.manager');
30-
$items = $manager->pool->collect($manager->getRecords())->getItems();
30+
$items = ExecutorFacade::getPool()
31+
->collect(ExecutorFacade::getRecords())
32+
->getItems();
3133

3234
$name = $this->argument('name');
3335
$tags = $this->option('tags');
@@ -50,7 +52,7 @@ public function handle()
5052
if (empty($toRun)) {
5153
$this->warn('There are no executors need to be executed.');
5254
} else {
53-
$batch = $manager->getNextBatchNumber();
55+
$batch = ExecutorFacade::getNextBatchNumber();
5456

5557
foreach ($toRun as $item) {
5658
$this->info("Executing {$item->name}...");

0 commit comments

Comments
 (0)