Skip to content

Commit f86f161

Browse files
authored
Update ConsumeCommand.php
1 parent 3c36c97 commit f86f161

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/Console/ConsumeCommand.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,7 @@ final class ConsumeCommand extends WorkCommand
3737

3838
public function handle(): int|null
3939
{
40-
$consumer = $this->worker;
4140
$numProcesses = $this->option('num-processes');
42-
43-
$consumer->setContainer($this->laravel);
44-
$consumer->setName($this->option('name'));
45-
$consumer->setConsumerTag($this->consumerTag());
46-
$consumer->setMaxPriority((int) $this->option('max-priority'));
47-
$consumer->setPrefetchSize((int) $this->option('prefetch-size'));
48-
$consumer->setPrefetchCount((int) $this->option('prefetch-count'));
4941

5042
for ($i = 0; $i < $numProcesses; $i++) {
5143
$pid = pcntl_fork();
@@ -69,6 +61,21 @@ public function handle(): int|null
6961
return 0;;
7062
}
7163

64+
65+
private function consume(): void
66+
{
67+
$consumer = $this->worker;
68+
69+
$consumer->setContainer($this->laravel);
70+
$consumer->setName($this->option('name'));
71+
$consumer->setConsumerTag($this->consumerTag());
72+
$consumer->setMaxPriority((int) $this->option('max-priority'));
73+
$consumer->setPrefetchSize((int) $this->option('prefetch-size'));
74+
$consumer->setPrefetchCount((int) $this->option('prefetch-count'));
75+
76+
parent::handle();
77+
}
78+
7279
private function consumerTag(): string
7380
{
7481
if ($consumerTag = $this->option('consumer-tag')) {

0 commit comments

Comments
 (0)