改名
This commit is contained in:
@@ -38,23 +38,17 @@ abstract class Pool extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param int $timeout
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function get($name, $timeout = -1)
|
protected function get($name)
|
||||||
{
|
{
|
||||||
if ($timeout != -1) {
|
[$timeout, $connection] = $this->_items[$name]->pop();
|
||||||
$client = $this->_items[$name]->pop($timeout);
|
|
||||||
} else {
|
|
||||||
$client = $this->_items[$name]->pop();
|
|
||||||
}
|
|
||||||
[$timeout, $connection] = $client;
|
|
||||||
if (!$this->checkCanUse($name, $timeout, $connection)) {
|
if (!$this->checkCanUse($name, $timeout, $connection)) {
|
||||||
unset($client);
|
unset($client);
|
||||||
return [0, null];
|
return [0, null];
|
||||||
} else {
|
} else {
|
||||||
return $client;
|
return [$timeout, $connection];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class Connection extends Pool
|
|||||||
*/
|
*/
|
||||||
public function getByChannel($coroutineName, $config)
|
public function getByChannel($coroutineName, $config)
|
||||||
{
|
{
|
||||||
[$time, $client] = $this->get($coroutineName, -1);
|
[$time, $client] = $this->get($coroutineName);
|
||||||
if ($client instanceof PDO) {
|
if ($client instanceof PDO) {
|
||||||
return $this->saveClient($coroutineName, $client);
|
return $this->saveClient($coroutineName, $client);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class Redis extends Pool
|
|||||||
$this->success('create redis client -> ' . $config['host'] . ':' . $this->size($coroutineName));
|
$this->success('create redis client -> ' . $config['host'] . ':' . $this->size($coroutineName));
|
||||||
return $this->saveClient($coroutineName, $this->createConnect($config));
|
return $this->saveClient($coroutineName, $this->createConnect($config));
|
||||||
}
|
}
|
||||||
[$time, $client] = $this->get($coroutineName, -1);
|
[$time, $client] = $this->get($coroutineName);
|
||||||
if ($client === null) {
|
if ($client === null) {
|
||||||
return $this->getByChannel($coroutineName, $config);
|
return $this->getByChannel($coroutineName, $config);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user