This commit is contained in:
2023-04-02 00:34:55 +08:00
parent 437e52896e
commit b4e9e204bc
2 changed files with 30 additions and 28 deletions
+6 -2
View File
@@ -155,9 +155,13 @@ class Pool extends Component
* @throws ConfigException
* @throws Exception
*/
public function get($name): mixed
public function get($name, $callback): mixed
{
return $this->channel($name)->pop();
$channel = $this->channel($name);
if (!$channel->isEmpty()) {
return $channel->pop();
}
return $callback();
}