name(self::POOL_NAME . '::' . $config['ServiceAddress'] . '::' . $config['ServicePort'], true); $pool = $config['pool'] ?? ['min' => 1, 'max' => 100]; return $this->getPool()->get($coroutineName, $callback, $pool['min'] ?? 1); } /** * @param \Swoole\Coroutine\Client|Client $client * @param $host * @param $port * @throws ConfigException * @throws Exception */ public function push(\Swoole\Coroutine\Client|Client $client, $host, $port) { $coroutineName = $this->name(self::POOL_NAME . '::' . $host . '::' . $port, true); $this->getPool()->push($coroutineName, $client); } /** * @return Pool * @throws Exception */ public function getPool(): Pool { return Kiri::getDi()->get(Pool::class); } }