From 32afd38ad45462c5fdb082944859a629e522e582 Mon Sep 17 00:00:00 2001 From: sunxyw Date: Wed, 4 Jan 2023 14:36:25 +0800 Subject: [PATCH 1/4] update bin permission --- bin/prepare-doxygen | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/prepare-doxygen diff --git a/bin/prepare-doxygen b/bin/prepare-doxygen old mode 100644 new mode 100755 From ed40799fe37b2692a2db25c4cf98091892f1c894 Mon Sep 17 00:00:00 2001 From: sunxyw Date: Wed, 4 Jan 2023 14:42:27 +0800 Subject: [PATCH 2/4] add .gitattributes --- .gitattributes | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..5bad95e0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,21 @@ +# Exclude build/test files from archive (reduce package size) +/.github export-ignore +/.phive export-ignore +/build export-ignore +/docs export-ignore +/ext export-ignore +/resources export-ignore +/tests export-ignore +/tests_old export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php-cs-fixer.php export-ignore +/captainhook.json export-ignore +/install-runtime.sh export-ignore +/package.json export-ignore +/phpstan.neon export-ignore +/phpunit.xml.dist export-ignore + +# Configure diff output +*.php diff=php From 3596d6077db5b7e4bcce95ce3a7e768b48fc127c Mon Sep 17 00:00:00 2001 From: sunxyw Date: Wed, 4 Jan 2023 15:26:41 +0800 Subject: [PATCH 3/4] fix php8.0 coroutine fail --- src/ZM/Event/Listener/WorkerEventListener.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ZM/Event/Listener/WorkerEventListener.php b/src/ZM/Event/Listener/WorkerEventListener.php index 540ed1b7..70b5b664 100644 --- a/src/ZM/Event/Listener/WorkerEventListener.php +++ b/src/ZM/Event/Listener/WorkerEventListener.php @@ -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'); From 863c2d8c7a19ec610eaf59594bc0ecc19d4f4fa1 Mon Sep 17 00:00:00 2001 From: sunxyw Date: Wed, 4 Jan 2023 15:33:38 +0800 Subject: [PATCH 4/4] add workflow timeout limit --- .github/workflows/coding-style.yml | 1 + .github/workflows/static-analysis.yml | 1 + .github/workflows/test.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/coding-style.yml b/.github/workflows/coding-style.yml index 09017f82..9847a787 100644 --- a/.github/workflows/coding-style.yml +++ b/.github/workflows/coding-style.yml @@ -24,6 +24,7 @@ jobs: if: ${{ needs.pre_job.outputs.should_skip != 'true' }} name: Code Style runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 1a61be59..0b813362 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -24,6 +24,7 @@ jobs: if: ${{ needs.pre_job.outputs.should_skip != 'true' }} name: Static Analysis runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a636b444..ed09c156 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,6 +36,7 @@ jobs: php-version: [ 8.0, 8.1, 8.2 ] name: PHP ${{ matrix.php-version }} Test (${{ matrix.operating-system }}) runs-on: ${{ matrix.operating-system }} + timeout-minutes: 10 steps: - name: Checkout uses: actions/checkout@v3