Update:增加防止因网络波动导致的状态更新失败
This commit is contained in:
parent
0856777633
commit
1d21fc72cf
@ -293,15 +293,22 @@ func AutoManuallyConfirmWorkTask() {
|
||||
continue
|
||||
}
|
||||
log.Printf("扣除余额成功,作品uuid:" + req.WorkUuid)
|
||||
_, err = service.CastProvider.UpdateStatus(context.Background(), &cast.UpdateStatusReq{
|
||||
WorkAction: cast.WorkActionENUM_CONFIRM,
|
||||
WorkUuid: req.WorkUuid,
|
||||
ConfirmRemark: req.ConfirmRemark,
|
||||
CostType: resp.UsedType,
|
||||
ConfirmStatus: 1,
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("更新作品状态失败,作品uuid:"+req.WorkUuid, zap.Error(err))
|
||||
var updateErr error
|
||||
for i := 0; i < 3; i++ {
|
||||
_, updateErr = service.CastProvider.UpdateStatus(context.Background(), &cast.UpdateStatusReq{
|
||||
WorkAction: cast.WorkActionENUM_CONFIRM,
|
||||
WorkUuid: req.WorkUuid,
|
||||
ConfirmRemark: req.ConfirmRemark,
|
||||
CostType: resp.UsedType,
|
||||
ConfirmStatus: 1,
|
||||
})
|
||||
if updateErr == nil {
|
||||
break
|
||||
}
|
||||
time.Sleep(time.Second * time.Duration(i+1)) // 退避重试
|
||||
}
|
||||
if updateErr != nil {
|
||||
log.Printf("更新作品状态失败(已重试3次),作品uuid:" + req.WorkUuid)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user