mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-29 12:02:56 +02:00
fix(channelserver): prevent guild RP rollover race and redundant stepup query
RolloverDailyRP now locks the guild row with SELECT FOR UPDATE and re-checks rp_reset_at inside the transaction, so concurrent callers cannot double-rollover and zero out freshly donated RP. Gacha stepup entry-type check is now skipped when the row was already deleted as stale, avoiding a redundant DELETE on step 0.
This commit is contained in:
@@ -327,14 +327,15 @@ func handleMsgMhfGetStepupStatus(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.logger.Error("Failed to reset stale gacha stepup", zap.Error(err))
|
||||
}
|
||||
step = 0
|
||||
}
|
||||
|
||||
hasEntry, _ := s.server.gachaRepo.HasEntryType(pkt.GachaID, step)
|
||||
if !hasEntry {
|
||||
if err := s.server.gachaRepo.DeleteStepup(pkt.GachaID, s.charID); err != nil {
|
||||
s.logger.Error("Failed to reset gacha stepup state", zap.Error(err))
|
||||
} else if err == nil {
|
||||
// Only check for valid entry type if the stepup is fresh
|
||||
hasEntry, _ := s.server.gachaRepo.HasEntryType(pkt.GachaID, step)
|
||||
if !hasEntry {
|
||||
if err := s.server.gachaRepo.DeleteStepup(pkt.GachaID, s.charID); err != nil {
|
||||
s.logger.Error("Failed to reset gacha stepup state", zap.Error(err))
|
||||
}
|
||||
step = 0
|
||||
}
|
||||
step = 0
|
||||
}
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(step)
|
||||
|
||||
Reference in New Issue
Block a user