- replace all goroutine and AfterFunc with recover version
This commit is contained in:
@@ -14,7 +14,7 @@ func Init() {
|
||||
|
||||
func RefreshEbaiRealMobile() {
|
||||
ebai.CurPurchaseHandler.RefreshRealMobile(jxcontext.AdminCtx, time.Now().Add(-6*time.Hour), utils.DefaultTimeValue, true, true)
|
||||
time.AfterFunc(1*time.Hour, func() {
|
||||
utils.AfterFuncWithRecover(1*time.Hour, func() {
|
||||
RefreshEbaiRealMobile()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ func scheduleDailyRoutine(isFirst bool) {
|
||||
UpdateJdPromotionStatus()
|
||||
}
|
||||
// globals.SugarLogger.Debug(duration)
|
||||
time.AfterFunc(duration, func() {
|
||||
utils.AfterFuncWithRecover(duration, func() {
|
||||
UpdateJdPromotionStatus()
|
||||
scheduleDailyRoutine(false)
|
||||
})
|
||||
@@ -213,12 +213,12 @@ func scheduleDailyRoutine(isFirst bool) {
|
||||
|
||||
func scheduleRoutine(isFirst bool) {
|
||||
if isFirst {
|
||||
go func() {
|
||||
utils.CallFuncAsync(func() {
|
||||
RefreshJdLockStoreSku()
|
||||
RefreshJdStoreSkuStock(0, nil)
|
||||
}()
|
||||
})
|
||||
}
|
||||
time.AfterFunc(stockRefreshGap, func() {
|
||||
utils.AfterFuncWithRecover(stockRefreshGap, func() {
|
||||
RefreshJdLockStoreSku()
|
||||
RefreshJdStoreSkuStock(0, nil)
|
||||
scheduleRoutine(false)
|
||||
@@ -887,7 +887,7 @@ func OnStoreStockMsg(msg *jdapi.CallbackStoreStockMsg) (retVal *jdapi.CallbackRe
|
||||
sku := &model.Sku{}
|
||||
sku.JdID = msg.SkuId
|
||||
if err = dao.GetEntity(db, sku, model.FieldJdID); err == nil {
|
||||
go func() {
|
||||
utils.CallFuncAsync(func() {
|
||||
if msg.Vendibility == 1 {
|
||||
vendibility := &jdapi.StockVendibility{
|
||||
OutSkuId: utils.Int2Str(sku.ID),
|
||||
@@ -906,7 +906,7 @@ func OnStoreStockMsg(msg *jdapi.CallbackStoreStockMsg) (retVal *jdapi.CallbackRe
|
||||
stock,
|
||||
}, userName)
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
}
|
||||
return jdapi.Err2CallbackResponse(err, "")
|
||||
@@ -917,7 +917,7 @@ func OnNewPromotionMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackRespo
|
||||
}
|
||||
|
||||
func createLocalPromotionFromRemote(promotionInfoId int64) (retVal *jdapi.CallbackResponse) {
|
||||
go func() {
|
||||
utils.CallFuncAsync(func() {
|
||||
result, err := api.JdAPI.QueryPromotionInfo(promotionInfoId)
|
||||
if err == nil {
|
||||
db := dao.GetDB()
|
||||
@@ -1005,7 +1005,7 @@ func createLocalPromotionFromRemote(promotionInfoId int64) (retVal *jdapi.Callba
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
})
|
||||
return jdapi.Err2CallbackResponse(nil, "")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user