This commit is contained in:
2021-01-04 16:20:08 +08:00
parent f5db735597
commit 0bd6441927
2 changed files with 12 additions and 6 deletions
+11 -5
View File
@@ -47,14 +47,20 @@ class Redis extends Component
*/ */
public function createPool() public function createPool()
{ {
$connections = Snowflake::app()->pool->redis; try {
$connections = Snowflake::app()->pool->redis;
$config = $this->get_config(); $config = $this->get_config();
$name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases']; $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());
}
} }
+1 -1
View File
@@ -413,7 +413,7 @@ class Connection extends Pool
public function desc(string $name) public function desc(string $name)
{ {
if (!isset($this->hasCreate[$name])) { if (!isset($this->hasCreate[$name])) {
return; $this->hasCreate[$name] = 0;
} }
$this->hasCreate[$name] -= 1; $this->hasCreate[$name] -= 1;
} }