modify
This commit is contained in:
@@ -84,7 +84,7 @@ class Annotation extends Component
|
||||
* @param string|null $outPath
|
||||
* @throws Exception
|
||||
*/
|
||||
public function instanceDirectoryFiles(string $dir, ?string $outPath = null)
|
||||
public function runtime(string $dir, ?string $outPath = null)
|
||||
{
|
||||
$this->_loader->loadByDirectory($dir, $outPath);
|
||||
}
|
||||
|
||||
@@ -46,16 +46,16 @@ class OnWorkerStart extends Callback
|
||||
$annotation->setLoader($runtime);
|
||||
|
||||
if ($worker_id >= $server->setting['worker_num']) {
|
||||
$annotation->instanceDirectoryFiles(MODEL_PATH);
|
||||
$annotation->runtime(MODEL_PATH);
|
||||
|
||||
$this->onTask($server, $worker_id);
|
||||
} else {
|
||||
$start = microtime(true);
|
||||
|
||||
$annotation->instanceDirectoryFiles($workerDir = realpath(APP_PATH . 'app/Http'));
|
||||
$annotation->runtime($workerDir = directory('app/Http'));
|
||||
$this->error('use time ' . (microtime(true) - $start));
|
||||
Coroutine\go(function () use ($annotation, $workerDir) {
|
||||
$annotation->instanceDirectoryFiles(APP_PATH, $workerDir);
|
||||
$annotation->runtime(directory('app'), $workerDir);
|
||||
});
|
||||
|
||||
$this->onWorker($server, $worker_id);
|
||||
|
||||
@@ -143,7 +143,7 @@ class Application extends BaseApplication
|
||||
$manager->setParameters($argv);
|
||||
$class = $manager->search();
|
||||
if (!($class instanceof Command)) {
|
||||
scan_directory(APP_PATH, 'APP');
|
||||
scan_directory(directory('app'), 'App');
|
||||
}
|
||||
response()->send($manager->execCommand($class));
|
||||
} catch (\Throwable $exception) {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class Runtime extends Command
|
||||
// TODO: Implement onHandler() method.
|
||||
|
||||
$annotation = Snowflake::app()->getAnnotation();
|
||||
$annotation->read(APP_PATH, 'App');
|
||||
$annotation->read(directory('app'), 'App');
|
||||
|
||||
$runtime = storage('runtime.php');
|
||||
|
||||
|
||||
+3
-2
@@ -90,8 +90,9 @@ if (!function_exists('scan_directory')) {
|
||||
*/
|
||||
function scan_directory($dir, $namespace)
|
||||
{
|
||||
\annotation()->read($dir, $namespace);
|
||||
\annotation()->instanceDirectoryFiles($dir);
|
||||
$annotation = Snowflake::app()->getAnnotation();
|
||||
$annotation->read($dir, $namespace);
|
||||
$annotation->runtime($dir, $namespace);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user