Refactoring: extract process handling from async job.
This commit is contained in:
@@ -23,21 +23,21 @@ class RunCommand extends Component
|
||||
{
|
||||
$this->isKeepAliveOn = true;
|
||||
|
||||
$this->activity = coolifyProcess($this->command, 'testing-host');
|
||||
$this->activity = remoteProcess($this->command, 'testing-host');
|
||||
}
|
||||
|
||||
public function runSleepingBeauty()
|
||||
{
|
||||
$this->isKeepAliveOn = true;
|
||||
|
||||
$this->activity = coolifyProcess('x=1; while [ $x -le 40 ]; do sleep 0.1 && echo "Welcome $x times" $(( x++ )); done', 'testing-host');
|
||||
$this->activity = remoteProcess('x=1; while [ $x -le 40 ]; do sleep 0.1 && echo "Welcome $x times" $(( x++ )); done', 'testing-host');
|
||||
}
|
||||
|
||||
public function runDummyProjectBuild()
|
||||
{
|
||||
$this->isKeepAliveOn = true;
|
||||
|
||||
$this->activity = coolifyProcess(<<<EOT
|
||||
$this->activity = remoteProcess(<<<EOT
|
||||
cd projects/dummy-project
|
||||
~/.docker/cli-plugins/docker-compose build --no-cache
|
||||
EOT, 'testing-host');
|
||||
|
@@ -7,7 +7,6 @@ use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Process\ProcessResult;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Spatie\Activitylog\Contracts\Activity;
|
||||
|
@@ -3,7 +3,6 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Jobs\ExecuteCoolifyProcess;
|
||||
use Illuminate\Process\ProcessResult;
|
||||
use Spatie\Activitylog\Contracts\Activity;
|
||||
|
||||
class CoolifyProcess
|
||||
@@ -36,8 +35,11 @@ class CoolifyProcess
|
||||
|
||||
dispatch($job);
|
||||
|
||||
$this->activity->refresh();
|
||||
|
||||
ray($this->activity->id);
|
||||
|
||||
return $this->activity;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user