mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-17 20:54:52 +08:00
fix php8.0 coroutine fail
This commit is contained in:
parent
ed40799fe3
commit
3596d6077d
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace ZM\Event\Listener;
|
||||
|
||||
use OneBot\Driver\Coroutine\Adaptive;
|
||||
use OneBot\Driver\Coroutine\CoroutineInterface;
|
||||
use OneBot\Driver\Process\ProcessManager;
|
||||
use OneBot\Util\Singleton;
|
||||
use ZM\Annotation\AnnotationHandler;
|
||||
@ -96,9 +97,13 @@ class WorkerEventListener
|
||||
$this->initUserPlugins();
|
||||
|
||||
// handle @Init annotation
|
||||
Adaptive::getCoroutine()->create(function () {
|
||||
if (Adaptive::getCoroutine() instanceof CoroutineInterface) {
|
||||
Adaptive::getCoroutine()->create(function () {
|
||||
$this->dispatchInit();
|
||||
});
|
||||
} else {
|
||||
$this->dispatchInit();
|
||||
});
|
||||
}
|
||||
// 回显 debug 日志:进程占用的内存
|
||||
$memory_total = memory_get_usage() / 1024 / 1024;
|
||||
logger()->debug('Worker process used ' . round($memory_total, 3) . ' MB');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user