open-smf / connection-pool

A common connection pool based on Swoole is usually used as a database connection pool.
MIT License
222 stars 34 forks source link

连接不能响应, #9

Closed wdaglb closed 3 years ago

wdaglb commented 3 years ago

环境

php 8.0.1
swoole 4.5.9

经过调试,貌似是Smf\ConnectionPool\ConnectionPool->init()里面go函数的问题 更改成这样可以响应:

    public function init(): bool
    {
        if ($this->initialized) {
            return false;
        }
        $this->initialized = true;
        $this->pool = new Channel($this->maxActive);
        $this->balancerTimerId = $this->startBalanceTimer($this->idleCheckInterval);
        for ($i = 0; $i < $this->minActive; $i++) {
            $connection = $this->createConnection();
            $ret = $this->pool->push($connection, static::CHANNEL_TIMEOUT);
            if ($ret === false) {
                $this->removeConnection($connection);
            }
        }
        return true;
    }
wdaglb commented 3 years ago

是我把swoole.use_shortname关了