modify
This commit is contained in:
@@ -9,6 +9,7 @@ use HttpServer\Abstracts\Callback;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Snowflake;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Coroutine\System;
|
||||
use Swoole\Server;
|
||||
|
||||
@@ -32,10 +33,7 @@ class OnWorkerStart extends Callback
|
||||
putenv('state=start');
|
||||
putenv('worker=' . $worker_id);
|
||||
|
||||
$content = System::readFile(storage('runtime.php'));
|
||||
|
||||
$annotation = Snowflake::app()->getAnnotation();
|
||||
$annotation->setLoader(unserialize($content));
|
||||
$annotation = $this->settings();
|
||||
if ($worker_id < $server->setting['worker_num']) {
|
||||
$this->onWorker($server, $annotation);
|
||||
} else {
|
||||
@@ -44,6 +42,21 @@ class OnWorkerStart extends Callback
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Annotation\Annotation
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function settings(): Annotation
|
||||
{
|
||||
$content = System::readFile(storage('runtime.php'));
|
||||
|
||||
$annotation = Snowflake::app()->getAnnotation();
|
||||
$annotation->setLoader(unserialize($content));
|
||||
|
||||
return $annotation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Server $server
|
||||
* @param int $worker_id
|
||||
|
||||
Reference in New Issue
Block a user