改名
This commit is contained in:
@@ -5,8 +5,8 @@ namespace Annotation;
|
|||||||
|
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Snowflake\Snowflake;
|
|
||||||
use Snowflake\Event;
|
use Snowflake\Event;
|
||||||
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class LocalService
|
* Class LocalService
|
||||||
@@ -42,12 +42,16 @@ use Snowflake\Event;
|
|||||||
Snowflake::set($this->service, $class);
|
Snowflake::set($this->service, $class);
|
||||||
if ($this->async_reload === true) {
|
if ($this->async_reload === true) {
|
||||||
$event = Snowflake::app()->getEvent();
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->on(Event::SERVER_WORKER_EXIT, function () {
|
$event->on(Event::SERVER_WORKER_EXIT, [$this, 'clear']);
|
||||||
Snowflake::app()->remove($this->service);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::execute($handler); // TODO: Change the autogenerated stub
|
return parent::execute($handler); // TODO: Change the autogenerated stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function clear()
|
||||||
|
{
|
||||||
|
Snowflake::app()->remove($this->service);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user