From 916401f1f0ead88249f9dc544f19aa03ddac6d53 Mon Sep 17 00:00:00 2001 From: baraayyash Date: Mon, 2 May 2016 12:18:01 +0300 Subject: [PATCH 1/2] attach name insted of queue and env --- src/AsyncQueue.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/AsyncQueue.php b/src/AsyncQueue.php index 75f72cd..1876f0f 100644 --- a/src/AsyncQueue.php +++ b/src/AsyncQueue.php @@ -27,10 +27,10 @@ public function __construct(array $config) * * @return int */ - public function push($job, $data = '', $queue = null) + public function push($job, $data = '', $name = '') { $id = $this->storeJob($job, $data, 0); - $this->startProcess($id, 0); + $this->startProcess($id, 0, $name); return $id; } @@ -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 = '') { - $command = $this->getCommand($jobId, $delay); + $command = $this->getCommand($jobId, $delay, $name); $cwd = $this->container['path.base']; $process = new Process($command, $cwd); @@ -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); } /** From 345db452f3a657011bdb5998d89937edf7568fa9 Mon Sep 17 00:00:00 2001 From: baraayyash Date: Mon, 2 May 2016 12:35:25 +0300 Subject: [PATCH 2/2] the same for delay --- src/AsyncQueue.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AsyncQueue.php b/src/AsyncQueue.php index 1876f0f..f453417 100644 --- a/src/AsyncQueue.php +++ b/src/AsyncQueue.php @@ -27,7 +27,7 @@ public function __construct(array $config) * * @return int */ - public function push($job, $data = '', $name = '') + public function push($job, $data = '', $name = null) { $id = $this->storeJob($job, $data, 0); $this->startProcess($id, 0, $name); @@ -67,7 +67,7 @@ public function storeJob($job, $data, $delay = 0) * * @return void */ - public function startProcess($jobId, $delay = 0, $name = '') + public function startProcess($jobId, $delay = 0, $name = null) { $command = $this->getCommand($jobId, $delay, $name); $cwd = $this->container['path.base']; @@ -132,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; }