持久化失败会提前结束任务进行抛错
This commit is contained in:
@@ -212,7 +212,7 @@ func (s *sGameAct) Save(ctx context.Context, actId int) (err error) {
|
|||||||
if len(delKey) > 0 {
|
if len(delKey) > 0 {
|
||||||
for _, v := range update {
|
for _, v := range update {
|
||||||
v.UpdatedAt = gtime.Now()
|
v.UpdatedAt = gtime.Now()
|
||||||
_, err2 := g.Model(Name).Where(do.GameAct{
|
updateRes, err2 := g.Model(Name).Where(do.GameAct{
|
||||||
Uid: v.Uid,
|
Uid: v.Uid,
|
||||||
ActId: v.ActId,
|
ActId: v.ActId,
|
||||||
}).Data(v).Update()
|
}).Data(v).Update()
|
||||||
@@ -220,6 +220,10 @@ func (s *sGameAct) Save(ctx context.Context, actId int) (err error) {
|
|||||||
g.Log().Error(ctx, err2)
|
g.Log().Error(ctx, err2)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if row, _ := updateRes.RowsAffected(); row == 0 {
|
||||||
|
g.Log().Error(ctx, "本次更新为0,更新数据失败: %v", v)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
update = make([]*entity.GameAct, 0)
|
update = make([]*entity.GameAct, 0)
|
||||||
var count int64
|
var count int64
|
||||||
|
|||||||
Reference in New Issue
Block a user