From 93ca2318bd00fe8ca589277505adb5de7ba1f350 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Fri, 23 Apr 2021 03:45:46 +0800 Subject: [PATCH] modify --- System/Abstracts/Pool.php | 24 ------------------------ System/Pool/Connection.php | 6 ------ System/Pool/Redis.php | 9 +-------- 3 files changed, 1 insertion(+), 38 deletions(-) diff --git a/System/Abstracts/Pool.php b/System/Abstracts/Pool.php index 391d545e..a64826a0 100644 --- a/System/Abstracts/Pool.php +++ b/System/Abstracts/Pool.php @@ -157,30 +157,6 @@ abstract class Pool extends Component } - /** - * @param $cds - * @param $coroutineName - * @param false $isBefore - * @throws Exception - */ - public function printClients($cds, $coroutineName, $isBefore = false) - { - $this->warning(($isBefore ? 'before ' : '') . 'create client[address: ' . $cds . ', ' . env('worker', 0) . ', coroutine: ' . Coroutine::getCid() . ', has num: ' . $this->size($coroutineName) . ']'); - } - - - /** - * @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; diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index bebac1ee..610fc2bb 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -154,8 +154,6 @@ class Connection extends Pool */ public function createClient(string $name, mixed $config): PDO { - $this->printClients($config['cds'], $name, true); - // TODO: Implement createClient() method. $link = new PDO($config['cds'], $config['username'], $config['password'], [ PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_CASE => PDO::CASE_NATURAL, @@ -195,8 +193,6 @@ class Connection extends Pool return; } - $this->releaseClients('rds', $coroutineName); - /** @var PDO $client */ $client = Context::getContext($coroutineName); if ($client->inTransaction()) { @@ -224,8 +220,6 @@ class Connection extends Pool */ public function connection_clear() { - $this->releaseClients('rds', 'rds'); - $this->flush(0); } diff --git a/System/Pool/Redis.php b/System/Pool/Redis.php index 83e3e6eb..78866edb 100644 --- a/System/Pool/Redis.php +++ b/System/Pool/Redis.php @@ -7,7 +7,6 @@ namespace Snowflake\Pool; use HttpServer\Http\Context; use Redis as SRedis; -use Snowflake\Exception\ComponentException; use Snowflake\Exception\RedisConnectException; use Exception; use Snowflake\Abstracts\Pool; @@ -57,7 +56,6 @@ class Redis extends Pool */ public function createClient(string $name, mixed $config): SRedis { - $this->printClients($config['host'], $name, true); $redis = new SRedis(); if (!$redis->pconnect($config['host'], (int)$config['port'], $config['timeout'])) { throw new RedisConnectException(sprintf('The Redis Connect %s::%d Fail.', $config['host'], $config['port'])); @@ -90,8 +88,6 @@ class Redis extends Pool return; } - $this->releaseClients($config['host'], $coroutineName); - $this->push($coroutineName, Context::getContext($coroutineName)); $this->remove($coroutineName); $this->lastTime = time(); @@ -111,10 +107,7 @@ class Redis extends Pool $this->remove($coroutineName); } - - $this->releaseClients($config['host'], $coroutineName); - - $this->clean($coroutineName); + $this->flush(0); } /**