This commit is contained in:
2021-07-05 11:23:57 +08:00
parent ee23b78872
commit 2ca845a65c
3 changed files with 13 additions and 37 deletions
+3 -13
View File
@@ -174,6 +174,9 @@ abstract class Pool extends Component
{
if (!isset(static::$_items[$name])) {
static::$_items[$name] = new Channel(Config::get('databases.pool.max', 10));
if ($this->creates === -1) {
$this->creates = Timer::tick(1000, [$this, 'Heartbeat_detection'], $name);
}
}
return static::$_items[$name];
}
@@ -250,19 +253,6 @@ abstract class Pool extends Component
}
/**
* @param string $name
* @return bool
*/
public function canCreate(string $name): bool
{
if (!isset(static::$hasCreate[$name])) {
static::$hasCreate[$name] = 0;
}
return static::$hasCreate[$name] < $this->max;
}
/**
* @param string $name
* @return bool