Commit 62315818 authored by hujiebin's avatar hujiebin

// 标记已经处理,mark比publish事件提前,尽量避免异步事件重复执行

parent 3d69aefe
...@@ -56,17 +56,17 @@ func (s *GiftSendEventService) Consume() error { ...@@ -56,17 +56,17 @@ func (s *GiftSendEventService) Consume() error {
model.Log.Errorf("json msg fail,event:%v,err:%v", cpEvent, err) model.Log.Errorf("json msg fail,event:%v,err:%v", cpEvent, err)
return nil return nil
} }
if err := gift_ev.PublishSendGiftEvent(model, sendGiftEvent); err != nil { // 标记已经处理,mark比publish事件提前,尽量避免异步事件重复执行
model.Log.Errorf("PublishSendGiftEvent fail,event:%v,err:%v", string(cpEvent.Payload), err)
return err
}
// 标记已经处理
cpEvent.Model = model cpEvent.Model = model
err = cpEvent.MarkDone() err = cpEvent.MarkDone()
if err != nil { if err != nil {
model.Log.Errorf("consume msg fail,event:%v,err:%v", cpEvent, err) model.Log.Errorf("consume msg fail,event:%v,err:%v", cpEvent, err)
return err return err
} }
if err := gift_ev.PublishSendGiftEvent(model, sendGiftEvent); err != nil {
model.Log.Errorf("PublishSendGiftEvent fail,event:%v,err:%v", string(cpEvent.Payload), err)
return err
}
return nil return nil
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment