Skip to content

Commit

Permalink
Fix checking parent id (#989)
Browse files Browse the repository at this point in the history
  • Loading branch information
halaei authored Mar 16, 2021
1 parent 831a5a8 commit 587288a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/QueueCommandString.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ public static function toWorkerOptionsString(SupervisorOptions $options)
*/
public static function toSupervisorOptionsString(SupervisorOptions $options)
{
return sprintf('--workers-name=%s --balance=%s --max-processes=%s --min-processes=%s --nice=%s --balance-cooldown=%s --balance-max-shift=%s %s',
return sprintf('--workers-name=%s --balance=%s --max-processes=%s --min-processes=%s --nice=%s --balance-cooldown=%s --balance-max-shift=%s --parent-id=%s %s',
$options->workersName,
$options->balance,
$options->maxProcesses,
$options->minProcesses,
$options->nice,
$options->balanceCooldown,
$options->balanceMaxShift,
$options->parentId,
static::toOptionsString($options)
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/SupervisorOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function __construct($name,
$this->nice = $nice;
$this->balanceCooldown = $balanceCooldown;
$this->balanceMaxShift = $balanceMaxShift;
$this->parentId = 0;
$this->parentId = $parentId;
}

/**
Expand Down Expand Up @@ -297,6 +297,7 @@ public function toArray()
'timeout' => $this->timeout,
'balanceCooldown' => $this->balanceCooldown,
'balanceMaxShift' => $this->balanceMaxShift,
'parentId' => $this->parentId,
];
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/AddSupervisorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function test_add_supervisor_command_creates_new_supervisor_on_master_pro
$this->assertCount(1, $master->supervisors);

$this->assertSame(
'exec '.$phpBinary.' artisan horizon:supervisor my-supervisor redis --workers-name=default --balance=off --max-processes=1 --min-processes=1 --nice=0 --balance-cooldown=3 --balance-max-shift=1 --backoff=0 --max-time=0 --max-jobs=0 --memory=128 --queue="default" --sleep=3 --timeout=60 --tries=0',
'exec '.$phpBinary.' artisan horizon:supervisor my-supervisor redis --workers-name=default --balance=off --max-processes=1 --min-processes=1 --nice=0 --balance-cooldown=3 --balance-max-shift=1 --parent-id=0 --backoff=0 --max-time=0 --max-jobs=0 --memory=128 --queue="default" --sleep=3 --timeout=60 --tries=0',
$master->supervisors->first()->process->getCommandLine()
);
}
Expand Down

0 comments on commit 587288a

Please sign in to comment.