改名
This commit is contained in:
@@ -6,6 +6,7 @@ namespace HttpServer\Events;
|
||||
use Annotation\Annotation;
|
||||
use Exception;
|
||||
use HttpServer\Abstracts\Callback;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Runtime;
|
||||
@@ -34,6 +35,8 @@ class OnWorkerStart extends Callback
|
||||
putenv('state=start');
|
||||
putenv('worker=' . $worker_id);
|
||||
|
||||
Config::sets(sweep(APP_PATH . 'config'));
|
||||
|
||||
$annotation = Snowflake::app()->getAnnotation();
|
||||
$annotation->setLoader(unserialize(file_get_contents(storage(Runtime::CACHE_NAME))));
|
||||
if ($worker_id >= $server->setting['worker_num']) {
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
* Time: 11:50
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
|
||||
use Exception;
|
||||
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
|
||||
@@ -46,6 +45,17 @@ class Config extends Component
|
||||
return $this->data[$key] = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $configs
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function sets(array $configs)
|
||||
{
|
||||
$config = Snowflake::app()->getConfig();
|
||||
$config->data = $configs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param bool $try
|
||||
@@ -69,7 +79,7 @@ class Config extends Component
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
if (!is_array($instance[$value]) ) {
|
||||
if (!is_array($instance[$value])) {
|
||||
return $instance[$value];
|
||||
}
|
||||
$instance = $instance[$value];
|
||||
|
||||
Reference in New Issue
Block a user