This commit is contained in:
2023-02-07 17:16:10 +08:00
parent 4f341594b5
commit d83f061a1c
2 changed files with 19 additions and 2 deletions
+14 -1
View File
@@ -129,7 +129,7 @@ class Pool extends Component
public function channel($name): PoolQueue
{
$channel = static::$_connections[$name] ?? null;
if (!($channel instanceof PoolQueue) ) {
if (!($channel instanceof PoolQueue)) {
throw new Exception('Channel is not exists.');
}
if ($channel->isClose()) {
@@ -139,6 +139,19 @@ class Pool extends Component
}
public function hasChannel($name, $max): bool
{
$channel = static::$_connections[$name] ?? null;
if (!($channel instanceof PoolQueue)) {
return false;
}
if ($channel->isClose()) {
return false;
}
return true;
}
/**
* @param $name
* @param $callback