From f48d9bc4649901be0786e28f96eb884377106b48 Mon Sep 17 00:00:00 2001 From: moemen gaballah Date: Thu, 25 Jul 2024 12:27:23 +0300 Subject: [PATCH 1/2] fix: removed unintended database write operation in sync method --- src/Console/ExecuteStatusCommand.php | 4 ++-- src/Services/ExecutorService.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Console/ExecuteStatusCommand.php b/src/Console/ExecuteStatusCommand.php index cb34e70..48ba2e0 100644 --- a/src/Console/ExecuteStatusCommand.php +++ b/src/Console/ExecuteStatusCommand.php @@ -35,8 +35,8 @@ public function handle(ExecutorService $service) $executor['name'], ucfirst($executor['type']->name), $executor['tag'], - $executor['model']->batch, - $executor['model']->executed > 0 ? 'Yes' : 'No', + $executor['model']?->batch, + $executor['model']?->executed > 0 ? 'Yes' : 'No', ]; }) ); diff --git a/src/Services/ExecutorService.php b/src/Services/ExecutorService.php index a848cf2..700f17d 100644 --- a/src/Services/ExecutorService.php +++ b/src/Services/ExecutorService.php @@ -79,7 +79,7 @@ public function sync() $batch = $this->getNextBatch(); $newExecutors->each(function ($executor) use (&$executors, $batch) { - $executor['model'] = Executor::create([ + $executor['model'] = new Executor([ 'executor' => $executor['name'], 'type' => $executor['type'], 'tag' => $executor['tag'], From c4deb3f9a62d0031f36ceb125789367610a6e77a Mon Sep 17 00:00:00 2001 From: moemen gaballah Date: Thu, 25 Jul 2024 12:45:37 +0300 Subject: [PATCH 2/2] add vendor and composer lock to gitignore --- .gitignore | 3 +++ src/Console/ExecuteStatusCommand.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..35024a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.lock +.phpunit.cache \ No newline at end of file diff --git a/src/Console/ExecuteStatusCommand.php b/src/Console/ExecuteStatusCommand.php index 48ba2e0..cb34e70 100644 --- a/src/Console/ExecuteStatusCommand.php +++ b/src/Console/ExecuteStatusCommand.php @@ -35,8 +35,8 @@ public function handle(ExecutorService $service) $executor['name'], ucfirst($executor['type']->name), $executor['tag'], - $executor['model']?->batch, - $executor['model']?->executed > 0 ? 'Yes' : 'No', + $executor['model']->batch, + $executor['model']->executed > 0 ? 'Yes' : 'No', ]; }) );