-
-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resolve issue in db driver to set delay job #208
Conversation
#207 PHP Warning 'yii\base\ErrorException' with message 'sleep() expects parameter 1 to be integer, string given'
@@ -74,6 +74,7 @@ public function init() | |||
*/ | |||
public function run($repeat, $delay = 0) | |||
{ | |||
$delay = intval($delay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(int) $delay
Please add a line to changelog. |
@@ -74,6 +74,7 @@ public function init() | |||
*/ | |||
public function run($repeat, $delay = 0) | |||
{ | |||
$delay = intval($delay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it is wrong way. $delay
param comes from console command as timeout option:
yii2-queue/src/drivers/db/Command.php
Lines 66 to 69 in a97007c
public function actionListen($timeout = 3) | |
{ | |
return $this->queue->run(true, $timeout); | |
} |
I think, it should be made as timeout param validation:
public function actionListen($timeout = 3)
{
if (!is_numeric($timeout)) {
throw new \yii\console\Exception('Timeout must be numeric.');
}
if ($timeout < 1) {
throw new \yii\console\Exception('Timeout must be greater that zero.');
}
return $this->queue->run(true, $timeout);
}
Closing then, won't be merged. |
#207
PHP Warning 'yii\base\ErrorException' with message 'sleep() expects parameter 1 to be integer, string given'