优化一键测试权重

This commit is contained in:
2026-03-13 15:47:12 +08:00
parent f5eaf8da30
commit 0b26afde70
19 changed files with 991 additions and 274 deletions

View File

@@ -25,6 +25,7 @@ class WeightTestProcess
/**
* 执行一条待完成的测试记录status=0
* 先原子更新为 STATUS_EXECUTING避免定时器 15 秒重入时同一条记录被重复执行(导致顺/逆时针各跑两倍次数)
*/
private function runOnePending(): void
{
@@ -35,6 +36,12 @@ class WeightTestProcess
return;
}
$recordId = (int) $record->id;
$affected = DiceRewardConfigRecord::where('id', $recordId)
->where('status', DiceRewardConfigRecord::STATUS_RUNNING)
->update(['status' => DiceRewardConfigRecord::STATUS_EXECUTING]);
if ($affected !== 1) {
return;
}
try {
(new WeightTestRunner())->run($recordId);
} catch (\Throwable $e) {