优化一键测试权重
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user