改名
This commit is contained in:
@@ -15,13 +15,13 @@ class ServerManager
|
|||||||
/**
|
/**
|
||||||
* @param $pool
|
* @param $pool
|
||||||
* @param $process
|
* @param $process
|
||||||
* @param $application
|
|
||||||
* @param $workerId
|
* @param $workerId
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function create($pool, $process, $application, $workerId)
|
public static function create($pool, $process, $workerId)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$application = Snowflake::get();
|
||||||
if (is_string($process) && class_exists($process)) {
|
if (is_string($process) && class_exists($process)) {
|
||||||
return static::createProcess($process, $application, $pool, $workerId);
|
return static::createProcess($process, $application, $pool, $workerId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ class Processes extends Component
|
|||||||
*/
|
*/
|
||||||
public function initCore()
|
public function initCore()
|
||||||
{
|
{
|
||||||
$application = Snowflake::get();
|
$server = new Pool($this->size(), SWOOLE_IPC_UNIXSOCK);
|
||||||
$server = $application->set(Pool::class, new Pool($this->size(), SWOOLE_IPC_UNIXSOCK));
|
$server->on('workerStart', function (Pool $pool, int $workerId) {
|
||||||
$server->on('workerStart', function (Pool $pool, int $workerId) use ($application) {
|
ServerManager::create($pool, $this->processes[$workerId], $workerId);
|
||||||
ServerManager::create($pool, $this->processes[$workerId], $application, $workerId);
|
|
||||||
});
|
});
|
||||||
$server->on('workerStop', function (Pool $pool, int $workerId) {
|
$server->on('workerStop', function (Pool $pool, int $workerId) {
|
||||||
$event = Snowflake::get()->event;
|
$event = Snowflake::get()->event;
|
||||||
|
|||||||
Reference in New Issue
Block a user