- use utils.CallFuncAsync to replace go
This commit is contained in:
@@ -65,12 +65,12 @@ func routinueFunc() {
|
|||||||
close(registerMsg.Chan2Close)
|
close(registerMsg.Chan2Close)
|
||||||
case ServerMsgNewOrder:
|
case ServerMsgNewOrder:
|
||||||
globals.SugarLogger.Debugf("msghub routinueFunc, msg:%s", utils.Format4Output(msg, false))
|
globals.SugarLogger.Debugf("msghub routinueFunc, msg:%s", utils.Format4Output(msg, false))
|
||||||
go func() {
|
utils.CallFuncAsync(func() {
|
||||||
for chan2Send := range channelMap[msg.StoreID] {
|
for chan2Send := range channelMap[msg.StoreID] {
|
||||||
chan2Send <- msg
|
chan2Send <- msg
|
||||||
delete(channelMap[msg.StoreID], chan2Send)
|
delete(channelMap[msg.StoreID], chan2Send)
|
||||||
}
|
}
|
||||||
}()
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ func GetMsg(ctx *jxcontext.Context, storeID int, lastOrderTime time.Time, lastOr
|
|||||||
|
|
||||||
func OnNewOrder(order *model.GoodsOrder) {
|
func OnNewOrder(order *model.GoodsOrder) {
|
||||||
globals.SugarLogger.Debugf("msghub OnNewOrder, order:%s", utils.Format4Output(order, false))
|
globals.SugarLogger.Debugf("msghub OnNewOrder, order:%s", utils.Format4Output(order, false))
|
||||||
go func() {
|
utils.CallFuncAsync(func() {
|
||||||
msgChan <- &ServerMsg{
|
msgChan <- &ServerMsg{
|
||||||
Type: ServerMsgNewOrder,
|
Type: ServerMsgNewOrder,
|
||||||
StoreID: jxutils.GetSaleStoreIDFromOrder(order),
|
StoreID: jxutils.GetSaleStoreIDFromOrder(order),
|
||||||
@@ -149,5 +149,5 @@ func OnNewOrder(order *model.GoodsOrder) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}()
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user