mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-23 16:45:35 +08:00
Fix OnSetup Attribute execution bug (build 452, release 2.7.3)
This commit is contained in:
@@ -28,7 +28,7 @@ use ZM\Exception\InitException;
|
|||||||
|
|
||||||
class ConsoleApplication extends Application
|
class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const VERSION_ID = 451;
|
public const VERSION_ID = 452;
|
||||||
|
|
||||||
public const VERSION = '2.7.3';
|
public const VERSION = '2.7.3';
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Doctrine\Common\Annotations\AnnotationReader;
|
use Doctrine\Common\Annotations\AnnotationReader;
|
||||||
|
use Koriym\Attributes\AttributeReader;
|
||||||
|
use Koriym\Attributes\DualReader;
|
||||||
use ZM\Annotation\Swoole\OnSetup;
|
use ZM\Annotation\Swoole\OnSetup;
|
||||||
use ZM\Annotation\Swoole\SwooleHandler;
|
use ZM\Annotation\Swoole\SwooleHandler;
|
||||||
use ZM\ConsoleApplication;
|
use ZM\ConsoleApplication;
|
||||||
@@ -36,7 +38,7 @@ try {
|
|||||||
$all_event_class = array_merge($all_event_class, ZMUtil::getClassesPsr4($autoload_path, $namespace));
|
$all_event_class = array_merge($all_event_class, ZMUtil::getClassesPsr4($autoload_path, $namespace));
|
||||||
}
|
}
|
||||||
|
|
||||||
$reader = new AnnotationReader();
|
$reader = new DualReader(new AnnotationReader(), new AttributeReader());
|
||||||
$event_list = [];
|
$event_list = [];
|
||||||
$setup_list = [];
|
$setup_list = [];
|
||||||
foreach ($all_event_class as $v) {
|
foreach ($all_event_class as $v) {
|
||||||
@@ -68,17 +70,3 @@ try {
|
|||||||
fclose($stderr);
|
fclose($stderr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
记迷惑,这里的代码是不是可以放到一个单独的文件里面,这样就不会出现每次都要重新加载的问题了?
|
|
||||||
然后这个文件就实现了,就是这个。
|
|
||||||
但是还有个什么问题呢?为了 reload 牺牲了太多太多,但是关键时刻好像又不是很能用到。
|
|
||||||
但又不能没有。
|
|
||||||
所以我很纠结很纠结。
|
|
||||||
如何让用户的代码能像 php-fpm 那样随时重置呢?
|
|
||||||
我不知道诶。
|
|
||||||
那这段代码干了个啥?
|
|
||||||
在最开始单独启动进程,加载一遍所有类,获取需要在启动前就执行的类,然后在启动的时候执行。
|
|
||||||
这样就可以不在爷进程里面加载所有类,在爹进程里面 Fork 的子进程再加载所有类,每次 reload 时可以重新加载了。
|
|
||||||
以上均为乱写的,请勿完全当真,本人对待框架代码还是比较认真的。
|
|
||||||
*/
|
|
||||||
|
|||||||
Reference in New Issue
Block a user