modify
This commit is contained in:
@@ -169,6 +169,18 @@ abstract class Pool extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $cds
|
||||||
|
* @param $coroutineName
|
||||||
|
* @param false $isBefore
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function releaseClients($cds, $coroutineName)
|
||||||
|
{
|
||||||
|
$this->warning('release client[address: ' . $cds . ', ' . env('worker', 0) . ', coroutine: ' . Coroutine::getCid() . ', has num: ' . $this->size($coroutineName) . ']');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
abstract public function createClient(string $name, mixed $config): mixed;
|
abstract public function createClient(string $name, mixed $config): mixed;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -195,6 +195,8 @@ class Connection extends Pool
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->releaseClients('rds', $coroutineName);
|
||||||
|
|
||||||
/** @var PDO $client */
|
/** @var PDO $client */
|
||||||
$client = Context::getContext($coroutineName);
|
$client = Context::getContext($coroutineName);
|
||||||
if ($client->inTransaction()) {
|
if ($client->inTransaction()) {
|
||||||
@@ -222,6 +224,8 @@ class Connection extends Pool
|
|||||||
*/
|
*/
|
||||||
public function connection_clear()
|
public function connection_clear()
|
||||||
{
|
{
|
||||||
|
$this->releaseClients('rds', 'rds');
|
||||||
|
|
||||||
$this->flush(0);
|
$this->flush(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ class Redis extends Pool
|
|||||||
if (!Context::hasContext($coroutineName)) {
|
if (!Context::hasContext($coroutineName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->releaseClients($config['host'], $coroutineName);
|
||||||
|
|
||||||
$this->push($coroutineName, Context::getContext($coroutineName));
|
$this->push($coroutineName, Context::getContext($coroutineName));
|
||||||
$this->remove($coroutineName);
|
$this->remove($coroutineName);
|
||||||
$this->lastTime = time();
|
$this->lastTime = time();
|
||||||
@@ -108,6 +111,9 @@ class Redis extends Pool
|
|||||||
|
|
||||||
$this->remove($coroutineName);
|
$this->remove($coroutineName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->releaseClients($config['host'], $coroutineName);
|
||||||
|
|
||||||
$this->clean($coroutineName);
|
$this->clean($coroutineName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user