-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
On Line number 119 of "ConnectionPool.php" that lives in path "connection-pool/src/"
You return a new connection without pushing it into empty channel as below:
return $this->createConnection();
How about pushing this the new connection into channel (Pool) first, and then pop the connection, like below;
$connection = $this->createConnection();`
$ret = $this->pool->push($connection, static::CHANNEL_TIMEOUT);
if ($ret === false) {
$this->removeConnection($connection);
}
.. instead of returning the connection right away ?
Recommended Code with its full context, as below:
if ($this->pool->isEmpty()) {
// Create more connections
if ($this->connectionCount < $this->maxActive) {
$connection = $this->createConnection(); `
// Lets push new connection to the channel as below, because channel is initialized and still have space as condition ($this->connectionCount < $this->maxActive) has evaluated to true
$ret = $this->pool->push($connection, static::CHANNEL_TIMEOUT);
if ($ret === false) {
$this->removeConnection($connection);
}
}
}
$connection = $this->pool->pop($this->maxWaitTime);
Metadata
Metadata
Assignees
Labels
No labels