Skip to content

Commit dd886e4

Browse files
committed
yiisoft#258: Fixed
1 parent 7a617e9 commit dd886e4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/cli/Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function beforeAction($action)
142142
*/
143143
public function actionExec($id, $ttr, $attempt, $pid)
144144
{
145-
if ($this->queue->execute($id, file_get_contents('php://stdin'), $ttr, $attempt, $pid)) {
145+
if ($this->queue->execute($id, file_get_contents('php://stdin'), $ttr, $attempt, $pid ?: null)) {
146146
return self::EXEC_DONE;
147147
}
148148
return self::EXEC_RETRY;
@@ -169,7 +169,7 @@ protected function handleMessage($id, $message, $ttr, $attempt)
169169
$id,
170170
$ttr,
171171
$attempt,
172-
$this->queue->getWorkerPid(),
172+
$this->queue->getWorkerPid() ?: 0,
173173
];
174174

175175
foreach ($this->getPassedOptions() as $name) {

src/cli/Queue.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ abstract class Queue extends BaseQueue implements BootstrapInterface
5757
public $messageHandler;
5858

5959
/**
60-
* @var int current process ID of a worker.
60+
* @var int|null current process ID of a worker.
6161
* @since 2.0.2
6262
*/
6363
private $_workerPid;
@@ -127,7 +127,7 @@ protected function runWorker(callable $handler)
127127
* Gets process ID of a worker.
128128
*
129129
* @inheritdoc
130-
* @return int
130+
* @return int|null
131131
* @since 2.0.2
132132
*/
133133
public function getWorkerPid()
@@ -152,7 +152,7 @@ protected function handleMessage($id, $message, $ttr, $attempt)
152152
* @param string $message
153153
* @param int $ttr time to reserve
154154
* @param int $attempt number
155-
* @param int $workerPid of worker process
155+
* @param int|null $workerPid of worker process
156156
* @return bool
157157
* @internal for worker command only
158158
*/

0 commit comments

Comments
 (0)