改名
This commit is contained in:
@@ -22,16 +22,19 @@ class ObjectPool extends \Snowflake\Abstracts\Pool
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set pool max length
|
* ObjectPool constructor.
|
||||||
|
* @param array $config
|
||||||
* @throws ComponentException
|
* @throws ComponentException
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function __construct($config = [])
|
||||||
{
|
{
|
||||||
$this->max = 5000;
|
$this->max = 5000;
|
||||||
|
|
||||||
|
|
||||||
$event = Snowflake::app()->getEvent();
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->on(Event::EVENT_AFTER_REQUEST, [$this, 'destruct']);
|
$event->on(Event::EVENT_AFTER_REQUEST, [$this, 'destruct']);
|
||||||
|
|
||||||
|
parent::__construct($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -80,10 +83,10 @@ class ObjectPool extends \Snowflake\Abstracts\Pool
|
|||||||
*/
|
*/
|
||||||
public function destruct()
|
public function destruct()
|
||||||
{
|
{
|
||||||
|
$this->warning('destruct object...');
|
||||||
if (empty($this->_waitRecover)) {
|
if (empty($this->_waitRecover)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->warning('destruct object...');
|
|
||||||
foreach ($this->_waitRecover as $name => $value) {
|
foreach ($this->_waitRecover as $name => $value) {
|
||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user