- replace all goroutine and AfterFunc with recover version

This commit is contained in:
gazebo
2019-03-15 10:26:30 +08:00
parent e5bf25bd04
commit dec14126a7
14 changed files with 30 additions and 29 deletions

View File

@@ -291,9 +291,9 @@ func (c *PurchaseHandler) postFakeFinishedPickupMsg(vendorOrderID string) {
"order_id": vendorOrderID,
},
}
go func() {
utils.CallFuncAsync(func() {
OnCallbackMsg(msg)
}()
})
}
func getTimeFromTimestampStr(sendTime string) time.Time {

View File

@@ -21,14 +21,14 @@ const (
)
func (c *PurchaseHandler) StartRefreshComment() {
time.AfterFunc(5*time.Second, func() {
utils.AfterFuncWithRecover(5*time.Second, func() {
c.refreshCommentOnce()
})
}
func (c *PurchaseHandler) refreshCommentOnce() {
c.RefreshComment(time.Now().Add(-RefreshCommentTime), time.Now())
time.AfterFunc(RefreshCommentTimeInterval, func() {
utils.AfterFuncWithRecover(RefreshCommentTimeInterval, func() {
c.refreshCommentOnce()
})
}

View File

@@ -250,7 +250,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
// 饿百支持创建sku时绑定商家分类了
// isCreate = true
// // 创建SKU后马上绑定分类会失败所以延迟绑定
// time.AfterFunc(3*time.Second, func() {
// utils.AfterFuncWithRecover(3*time.Second, func() {
// if err := api.EbaiAPI.SkuShopCategoryMap(strStoreID, storeSku.EbaiID, utils.Int64ToStr(storeSku.CatEbaiID)); err == nil {
// storeSku.EbaiSyncStatus = 0
// dao.UpdateEntity(nil, &storeSku.StoreSkuBind, updateFields...)