improve order slice lock

This commit is contained in:
c9s 2020-11-17 14:31:18 +08:00
parent ed6d6342e7
commit 18d9245b06

View File

@ -159,10 +159,11 @@ func (m *SyncOrderMap) Canceled() OrderSlice {
return m.FindByStatus(OrderStatusCanceled)
}
func (m *SyncOrderMap) Orders() OrderSlice {
func (m *SyncOrderMap) Orders() (slice OrderSlice) {
m.RLock()
defer m.RUnlock()
return m.orders.Orders()
slice = m.orders.Orders()
m.RUnlock()
return slice
}
type OrderSlice []Order