Skip to content

Commit

Permalink
1.9.12 - remove "default" queue from default queue name
Browse files Browse the repository at this point in the history
  • Loading branch information
Ozerich committed Jul 6, 2023
1 parent 8a91adf commit 5419e3c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 6 additions & 4 deletions src/Console/Command.php
Expand Up @@ -40,14 +40,16 @@ public function runJob(string|object $job, array $arguments = []): mixed
/**
* Run the given job in the given queue.
*/
public function runInQueue(string|object $job, array $arguments = [], string $queue = 'default'): mixed
public function runInQueue(string|object $job, array $arguments = [], string $queue = null): mixed
{

$reflection = new \ReflectionClass($job);
$jobInstance = $reflection->newInstanceArgs($arguments);
$jobInstance->onQueue((string)$queue);

Log::channel('queue')->info('Run in Queue (' . $queue . '): ' . $jobInstance::class . ' - ' . json_encode($arguments));
if ($queue) {
$jobInstance->onQueue($queue);
}

Log::channel('queue')->info('Run in Queue: ' . $jobInstance::class . ' - ' . json_encode($arguments));

return $this->dispatch($jobInstance);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/QueueJob.php
Expand Up @@ -40,7 +40,7 @@ protected static function marshal($command, array $extras = [])
return $reflection->newInstanceArgs($injected);
}

public function runNow($job, array $arguments = [])
public function run($job, array $arguments = [])
{
if (!is_object($job)) {
$job = $this->marshal($job, $arguments);
Expand Down
10 changes: 6 additions & 4 deletions src/Traits/JobDispatcherTrait.php
Expand Up @@ -64,16 +64,18 @@ public function runNow($job, array $arguments = [])
return $this->dispatchSync($job);
}

public function runInQueue($job, array $arguments = [], string $queue = 'default')
public function runInQueue($job, array $arguments = [], string $queue = null)
{
if (!is_object($job)) {
$job = $this->marshal($job, $arguments);
}

Log::channel('queue')->info('Run in Queue (' . $queue . '): ' . $job::class . ' - ' . json_encode($arguments));
Log::channel('queue')->info('Run in Queue: ' . $job::class . ' - ' . json_encode($arguments));

$job->onQueue($queue);
if ($queue) {
$job->onQueue($queue);
}

return $this->dispatch($job);
}
}
}

0 comments on commit 5419e3c

Please sign in to comment.