Refactoring: extract process handling from async job.

This commit is contained in:
Joao Patricio
2023-03-21 09:31:16 +00:00
parent be351232d3
commit d0d33da493
5 changed files with 15 additions and 18 deletions

View File

@@ -3,21 +3,17 @@
use App\Services\CoolifyProcess;
use Spatie\Activitylog\Contracts\Activity;
if (! function_exists('coolifyProcess')) {
if (! function_exists('remoteProcess')) {
/**
* Run a Coolify Process, which SSH's into a machine to run the command(s).
*
*/
function coolifyProcess($command, $destination): Activity
function remoteProcess($command, $destination): Activity
{
$process = resolve(CoolifyProcess::class, [
return resolve(CoolifyProcess::class, [
'destination' => $destination,
'command' => $command,
]);
$activityLog = $process();
return $activityLog;
])();
}
}