• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: 提交

Golang implemented sidechain for Bytom


Commit MetaInfo

修订版350afe3abb8c4ce5ca0d05ecbd72bdbf21ce8a2e (tree)
时间2020-02-06 19:45:05
作者shenao78 <shenao.78@163....>
Commitershenao78

Log Message

opt_mathch_collector

更改概述

差异

--- a/application/mov/match_collector.go
+++ b/application/mov/match_collector.go
@@ -127,22 +127,11 @@ func (m *matchCollector) tradePairProducer(wg *sync.WaitGroup) {
127127 }
128128
129129 func (m *matchCollector) matchTxWorker(wg *sync.WaitGroup) {
130- dispatchData := func(data *matchTxResult) bool {
131- select {
132- case <-m.closeCh:
133- return true
134- case m.processCh <- data:
135- if data.err != nil {
136- return true
137- }
138- return false
139- }
140- }
141-
142130 defer func() {
143131 m.workerNumCh <- 1
144132 wg.Done()
145133 }()
134+
146135 for {
147136 select {
148137 case <-m.closeCh:
@@ -153,8 +142,14 @@ func (m *matchCollector) matchTxWorker(wg *sync.WaitGroup) {
153142 }
154143 for m.engine.HasMatchedTx(tradePair, tradePair.Reverse()) {
155144 matchedTx, err := m.engine.NextMatchedTx(tradePair, tradePair.Reverse())
156- if done := dispatchData(&matchTxResult{matchedTx: matchedTx, err: err}); done {
145+ data := &matchTxResult{matchedTx: matchedTx, err: err}
146+ select {
147+ case <-m.closeCh:
157148 return
149+ case m.processCh <- data:
150+ if data.err != nil {
151+ return
152+ }
158153 }
159154 }
160155 }
Show on old repository browser