1.增加互斥锁:保证缓存和数据库数据一致性

2.增加消费队列,保证mysql数据的正常保存
This commit is contained in:
2026-04-20 14:13:48 +08:00
parent 614fb00ec4
commit 1eed3cf0f7
23 changed files with 836 additions and 255 deletions

View File

@@ -131,7 +131,7 @@ final class GameBetSettleService
'current_streak' => $next,
'update_time' => $now,
]);
GameHotDataRedis::userForget($userId);
GameHotDataCoordinator::afterUserCommitted($userId);
}
foreach ($aggregateByUser as $userId => $agg) {
@@ -273,7 +273,7 @@ final class GameBetSettleService
'bet_flow_coin' => Db::raw('bet_flow_coin + ' . $flow),
'update_time' => $now,
]);
GameHotDataRedis::userForget($userId);
GameHotDataCoordinator::afterUserCommitted($userId);
}
/**
@@ -321,7 +321,7 @@ final class GameBetSettleService
'coin' => $after,
'update_time' => $now,
]);
GameHotDataRedis::userForget($userId);
GameHotDataCoordinator::afterUserCommitted($userId);
return $after;
}