Rollback live sessions on panic
Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -14,13 +14,12 @@ import (
|
||||
func gameOver(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
token := ""
|
||||
defer func() {
|
||||
defer ss.FinalizeOrRollbackAfter(func() {
|
||||
if ss.UserEng != nil {
|
||||
deleteRandomLiveByToken(ss, token)
|
||||
ss.ClearLiveInProgress()
|
||||
}
|
||||
ss.Finalize()
|
||||
}()
|
||||
})
|
||||
|
||||
req := rliveschema.TokenReq{}
|
||||
err := honokautils.ParseRequestData(ctx, &req)
|
||||
|
||||
@@ -15,13 +15,12 @@ import (
|
||||
func reward(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
token := ""
|
||||
defer func() {
|
||||
defer ss.FinalizeOrRollbackAfter(func() {
|
||||
if ss.UserEng != nil {
|
||||
deleteRandomLiveByToken(ss, token)
|
||||
ss.ClearLiveInProgress()
|
||||
}
|
||||
ss.Finalize()
|
||||
}()
|
||||
})
|
||||
|
||||
req := rliveschema.RewardReq{}
|
||||
err := honokautils.ParseRequestData(ctx, &req)
|
||||
|
||||
Reference in New Issue
Block a user