private function getEffectiveConnection(int $queueNum, bool $isChannel = true): ConnectionInterface
    {
        $minActive = $this->poolConfig->getMinActive();
        if ($queueNum <= $minActive) {
            return $this->getOriginalConnection($isChannel);
        }

        $time        = time();
        $moreActive  = $queueNum - $minActive;
        $maxIdleTime = $this->poolConfig->getMaxIdleTime();
        for ($i = 0; $i < $moreActive; $i++) {
            /* @var ConnectionInterface $connection */
            $connection = $this->getOriginalConnection($isChannel);;
            $lastTime = $connection->getLastTime();
            if ($time - $lastTime < $maxIdleTime) {
                return $connection;
            }
            $this->currentCount--;
        }

        return $this->getOriginalConnection($isChannel);
    }
private function getEffectiveConnection(int $queueNum, bool $isChannel = true): ConnectionInterface
    {
        $minActive = $this->poolConfig->getMinActive();
        if ($queueNum <= $minActive) {
            return $this->getOriginalConnection($isChannel);
        }

        $time        = time();
        $moreActive  = $queueNum - $minActive;
        $maxIdleTime = $this->poolConfig->getMaxIdleTime();
        for ($i = 0; $i < $moreActive; $i++) {
            /* @var ConnectionInterface $connection */
            $connection = $this->getOriginalConnection($isChannel);;
            $lastTime = $connection->getLastTime();
            if ($time - $lastTime < $maxIdleTime) {
                return $connection;
            }
            $this->currentCount--;
        }

        return $this->getOriginalConnection($isChannel);
    }
private function getEffectiveConnection ( int $ queueNum , bool $ isChannel = true ) : ConnectionInterface { $ minActive = $ this -> poolConfig -> getMinActive ( ) ; if ( $ queueNum <= $ minActive ) { return $ this -> getOriginalConnection ( $ isChannel ) ; } $ time = time ( ) ; $ moreActive = $ queueNum - $ minActive ; $ maxIdleTime = $ this -> poolConfig -> getMaxIdleTime ( ) ; for ( $ i = 0 ; $ i < $ moreActive ; $ i ++ ) { /* @var ConnectionInterface $connection */ $ connection = $ this -> getOriginalConnection ( $ isChannel ) ; ; $ lastTime = $ connection -> getLastTime ( ) ; if ( $ time - $ lastTime < $ maxIdleTime ) { return $ connection ; } $ this -> currentCount -- ; } return $ this -> getOriginalConnection ( $ isChannel ) ; }
Get effective connection

@param int  $queueNum
@param bool $isChannel

@return ConnectionInterface
Get effective connection