改名
This commit is contained in:
@@ -379,10 +379,11 @@ class ServerManager
|
||||
/**
|
||||
* @param TaskExecute|string $handler
|
||||
* @param array $params
|
||||
* @param int $workerId
|
||||
* @param int|null $workerId
|
||||
* @throws ReflectionException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function task(TaskExecute|string $handler, array $params = [], int $workerId = 0)
|
||||
public function task(TaskExecute|string $handler, array $params = [], int $workerId = null)
|
||||
{
|
||||
if ($workerId === null || $workerId <= $this->server->setting['worker_num']) {
|
||||
$workerId = random_int($this->server->setting['worker_num'] + 1,
|
||||
|
||||
@@ -22,10 +22,6 @@ use HttpServer\Server;
|
||||
use HttpServer\Shutdown;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Kafka\KafkaProvider;
|
||||
use ReflectionException;
|
||||
use Rpc\Producer;
|
||||
use Rpc\Service;
|
||||
use Server\ServerManager;
|
||||
use Kiri\Aop;
|
||||
use Kiri\Async;
|
||||
use Kiri\Cache\Redis;
|
||||
@@ -37,6 +33,11 @@ use Kiri\Exception\InitException;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
use Kiri\Jwt\Jwt;
|
||||
use Kiri\Kiri;
|
||||
use ReflectionException;
|
||||
use Rpc\Producer;
|
||||
use Rpc\Service;
|
||||
use Server\ServerManager;
|
||||
use Server\SInterface\TaskExecute;
|
||||
use Swoole\Table;
|
||||
|
||||
/**
|
||||
@@ -199,6 +200,16 @@ abstract class BaseApplication extends Component
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param TaskExecute $execute
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function task(TaskExecute $execute): void
|
||||
{
|
||||
ServerManager::getContext()->task($execute);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $value
|
||||
|
||||
Reference in New Issue
Block a user