This commit is contained in:
2021-06-29 14:36:45 +08:00
parent c3d8a92b33
commit 2e6ca9b4fa
2 changed files with 5 additions and 3 deletions
+2
View File
@@ -175,6 +175,7 @@ class Connection extends Pool
$client->commit(); $client->commit();
} }
$this->push($coroutineName, $client); $this->push($coroutineName, $client);
Context::remove($coroutineName);
$this->lastTime = time(); $this->lastTime = time();
} }
@@ -231,6 +232,7 @@ class Connection extends Pool
*/ */
public function disconnect($coroutineName, bool $isMaster = false) public function disconnect($coroutineName, bool $isMaster = false)
{ {
Context::remove($coroutineName);
$coroutineName = $this->name($coroutineName, $isMaster); $coroutineName = $this->name($coroutineName, $isMaster);
$this->clean($coroutineName); $this->clean($coroutineName);
} }
+3 -3
View File
@@ -51,7 +51,7 @@ class Redis extends Pool
* @return mixed * @return mixed
* @throws Exception * @throws Exception
*/ */
public function get(mixed $config, $isMaster = false): mixed public function get(mixed $config, bool $isMaster = false): mixed
{ {
$name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; $name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases'];
$coroutineName = $this->name('redis', 'redis:' . $name, $isMaster); $coroutineName = $this->name('redis', 'redis:' . $name, $isMaster);
@@ -98,7 +98,7 @@ class Redis extends Pool
* @param array $config * @param array $config
* @param bool $isMaster * @param bool $isMaster
*/ */
public function release(array $config, $isMaster = false) public function release(array $config, bool $isMaster = false)
{ {
$name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; $name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases'];
$coroutineName = $this->name('redis', 'redis:' . $name, $isMaster); $coroutineName = $this->name('redis', 'redis:' . $name, $isMaster);
@@ -116,7 +116,7 @@ class Redis extends Pool
* @param bool $isMaster * @param bool $isMaster
* @throws Exception * @throws Exception
*/ */
public function destroy(array $config, $isMaster = false) public function destroy(array $config, bool $isMaster = false)
{ {
$name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; $name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases'];
$coroutineName = $this->name('redis', 'redis:' . $name, $isMaster); $coroutineName = $this->name('redis', 'redis:' . $name, $isMaster);