Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/AsyncQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public function __construct(array $config)
*
* @return int
*/
public function push($job, $data = '', $queue = null)
public function push($job, $data = '', $name = null)
{
$id = $this->storeJob($job, $data, 0);
$this->startProcess($id, 0);
$this->startProcess($id, 0, $name);

return $id;
}
Expand Down Expand Up @@ -67,9 +67,9 @@ public function storeJob($job, $data, $delay = 0)
*
* @return void
*/
public function startProcess($jobId, $delay = 0)
public function startProcess($jobId, $delay = 0, $name = null)
{
$command = $this->getCommand($jobId, $delay);
$command = $this->getCommand($jobId, $delay, $name);
$cwd = $this->container['path.base'];

$process = new Process($command, $cwd);
Expand All @@ -84,15 +84,14 @@ public function startProcess($jobId, $delay = 0)
*
* @return string
*/
protected function getCommand($jobId, $delay = 0)
protected function getCommand($jobId, $delay = 0, $name = null)
{
$cmd = '%s artisan queue:async %d --env=%s --delay=%d';
$cmd = '%s artisan queue:async %d --name=%s --delay=%d';
$cmd = $this->getBackgroundCommand($cmd);

$binary = $this->getPhpBinary();
$environment = $this->container->environment();

return sprintf($cmd, $binary, $jobId, $environment, $delay);
return sprintf($cmd, $binary, $jobId, $name, $delay);
}

/**
Expand Down Expand Up @@ -133,11 +132,11 @@ protected function getBackgroundCommand($cmd)
*
* @return int
*/
public function later($delay, $job, $data = '', $queue = null)
public function later($delay, $job, $data = '', $name = null)
{
$delay = $this->getSeconds($delay);
$id = $this->storeJob($job, $data, $delay);
$this->startProcess($id, $delay);
$this->startProcess($id, $delay, $name);

return $id;
}
Expand Down