From 0bd6441927caaacb805404dd0d8fb072c4109d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 4 Jan 2021 16:20:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Cache/Redis.php | 16 +++++++++++----- System/Pool/Connection.php | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/System/Cache/Redis.php b/System/Cache/Redis.php index 667311c8..dbf89a75 100644 --- a/System/Cache/Redis.php +++ b/System/Cache/Redis.php @@ -47,14 +47,20 @@ class Redis extends Component */ public function createPool() { - $connections = Snowflake::app()->pool->redis; + try { + $connections = Snowflake::app()->pool->redis; - $config = $this->get_config(); - $name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; + $config = $this->get_config(); + $name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; - $length = env('REDIS.POOL_LENGTH', 100); + $length = env('REDIS.POOL_LENGTH', 100); - $connections->initConnections('redis:' . $name, true, $length); + $connections->initConnections('redis:' . $name, true, $length); + } catch (\Throwable $exception) { + var_dump($exception->getMessage()); + var_dump($exception->getFile()); + var_dump($exception->getLine()); + } } diff --git a/System/Pool/Connection.php b/System/Pool/Connection.php index 58360ebb..71cae9cf 100644 --- a/System/Pool/Connection.php +++ b/System/Pool/Connection.php @@ -413,7 +413,7 @@ class Connection extends Pool public function desc(string $name) { if (!isset($this->hasCreate[$name])) { - return; + $this->hasCreate[$name] = 0; } $this->hasCreate[$name] -= 1; }