From e6bd259b4364b85434826b7aaba207eb3bb9542d Mon Sep 17 00:00:00 2001 From: limeng <1131177064@qq.com> Date: Mon, 30 Nov 2026 14:26:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=91=E5=B8=83=E5=90=8E?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E9=95=9C=E5=83=8F=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=AD=89=E9=94=81=20(#1569)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/activate-incremental-release.sh | 5 ++++- deploy/activate-release.sh | 5 ++++- tests/Unit/Deployment/BusinessMirrorScheduleTest.php | 7 ++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/deploy/activate-incremental-release.sh b/deploy/activate-incremental-release.sh index 1c93d864..b30e49b2 100644 --- a/deploy/activate-incremental-release.sh +++ b/deploy/activate-incremental-release.sh @@ -273,7 +273,10 @@ EOF chmod 644 /etc/cron.d/caiwu-jiansun-snapshots # 本次发布立即校正一次供应商采购入库数据,避免等待次日定时任务。 -/usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan business-mirror:sync-supplier-payable-forecast --quiet >/dev/null 2>&1 || true +# 关闭子进程继承的发布锁和同步锁,等激活结束后再单独取得同步锁。 +/usr/bin/nohup /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock \ + /usr/bin/docker exec -u www-data caiwu_app php artisan business-mirror:sync-supplier-payable-forecast --quiet \ + /dev/null 2>&1 8>&- 9>&- & # OA 流程明细每 15 分钟同步结构化数据,并在同一批处理中增量补发票; # 审批快照再按 60 分钟新鲜度限频轮转,避免对长期不变的流程重复调用官方接口。 diff --git a/deploy/activate-release.sh b/deploy/activate-release.sh index 25b3bfff..3a5ee682 100644 --- a/deploy/activate-release.sh +++ b/deploy/activate-release.sh @@ -277,7 +277,10 @@ EOF chmod 644 /etc/cron.d/caiwu-jiansun-snapshots # 本次发布立即校正一次供应商采购入库数据,避免等待次日定时任务。 -/usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock /usr/bin/docker exec -u www-data caiwu_app php artisan business-mirror:sync-supplier-payable-forecast --quiet >/dev/null 2>&1 || true +# 关闭子进程继承的发布锁和同步锁,等激活结束后再单独取得同步锁。 +/usr/bin/nohup /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock \ + /usr/bin/docker exec -u www-data caiwu_app php artisan business-mirror:sync-supplier-payable-forecast --quiet \ + /dev/null 2>&1 8>&- 9>&- & # OA 流程明细每 15 分钟同步结构化数据,并在同一批处理中增量补发票; # 审批快照再按 60 分钟新鲜度限频轮转,避免对长期不变的流程重复调用官方接口。 diff --git a/tests/Unit/Deployment/BusinessMirrorScheduleTest.php b/tests/Unit/Deployment/BusinessMirrorScheduleTest.php index c755c2ba..785f2323 100644 --- a/tests/Unit/Deployment/BusinessMirrorScheduleTest.php +++ b/tests/Unit/Deployment/BusinessMirrorScheduleTest.php @@ -251,7 +251,12 @@ class BusinessMirrorScheduleTest extends TestCase $script, ); $this->assertStringContainsString( - '# 本次发布立即校正一次供应商采购入库数据,避免等待次日定时任务。', + '/usr/bin/nohup /usr/bin/flock -w 1800 /run/caiwu-upstream-sync.lock', + $contents, + $script, + ); + $this->assertStringContainsString( + '/dev/null 2>&1 8>&- 9>&- &', $contents, $script, );