变更
This commit is contained in:
+2
-3
@@ -68,15 +68,14 @@ class Task implements TaskInterface
|
|||||||
* @param array $handler
|
* @param array $handler
|
||||||
* @param int|null $workerId
|
* @param int|null $workerId
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function dispatch(array $handler, ?int $workerId = null): void
|
public function dispatch(array $handler, ?int $workerId = null): void
|
||||||
{
|
{
|
||||||
/** @var Server $server */
|
/** @var Server $server */
|
||||||
$server = \Kiri::service()->get('server');
|
$server = \Kiri::service()->get('server');
|
||||||
if (is_null($workerId)) {
|
if (is_null($workerId)) {
|
||||||
$worker = $server->setting[Constant::OPTION_TASK_WORKER_NUM];
|
$workerId = rand(0, $server->setting[Constant::OPTION_TASK_WORKER_NUM] - 1);
|
||||||
$workerId = rand(0, $worker);
|
|
||||||
}
|
}
|
||||||
$server->task(json_encode($handler), $workerId);
|
$server->task(json_encode($handler), $workerId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user