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, );