This commit is contained in:
2023-04-05 19:58:07 +08:00
parent fab3779116
commit 00ee4651b9
+7 -7
View File
@@ -101,13 +101,13 @@ class PoolItem
*/ */
public function pop(int $waite = 10): mixed public function pop(int $waite = 10): mixed
{ {
if ($this->_items->isEmpty() && $this->created < $this->maxCreated) { if (!$this->_items->isEmpty()) {
$client = call_user_func($this->callback); return $this->_items->pop();
$this->created += 1;
return $client;
} }
return $this->_items->pop($waite); if ($this->created > $this->maxCreated) {
return $this->_items->pop($waite);
}
$this->created += 1;
return call_user_func($this->callback);
} }
} }