Skip to content

Commit

Permalink
remove orderInfo from orderInfoForPub when publish anything (#766)
Browse files Browse the repository at this point in the history
* add closed orders to ToRemoveOrderIdCh when ShouldPublishAny=true
  • Loading branch information
EnderCrypto authored Jul 14, 2020
1 parent 56c4912 commit 82e2af8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## 0.7.2-hf.1
BUG FIXES
* [\#766](https://github.com/binance-chain/node/pull/766)[Dex] remove orderInfo from orderInfoForPub when publish anything

## 0.7.2
BUG FIXES
Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ func (app *BinanceChain) publish(tradesToPublish []*pub.Trade, proposalsToPublis

if app.metrics != nil {
app.metrics.CollectBlockTimeMs.Set(float64(duration))
app.metrics.NumOrderInfoForPublish.Set(float64(len(orderInfoForPublish)))
}

pub.Logger.Info("start to publish", "height", height,
Expand Down
7 changes: 7 additions & 0 deletions app/pub/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type Metrics struct {
NumAccounts metricsPkg.Gauge
// num of transfer
NumTransfers metricsPkg.Gauge

NumOrderInfoForPublish metricsPkg.Gauge
}

// PrometheusMetrics returns Metrics build using Prometheus client library.
Expand Down Expand Up @@ -141,5 +143,10 @@ func PrometheusMetrics() *Metrics {
Name: "num_transfer",
Help: "Number of transfer we published",
}, []string{}),
NumOrderInfoForPublish: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Subsystem: "publication",
Name: "num_orderinfo_pub",
Help: "Number of OrderInfoForPublish in orderKeeper",
}, []string{}),
}
}
17 changes: 8 additions & 9 deletions app/pub/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ func Publish(
var opensToPublish []*Order
var closedToPublish []*Order
var feeToPublish map[string]string
if cfg.PublishOrderUpdates || cfg.PublishOrderBook {
opensToPublish, closedToPublish, feeToPublish = collectOrdersToPublish(
marketData.tradesToPublish,
marketData.orderChanges,
marketData.orderInfos,
marketData.feeHolder,
marketData.timestamp)
addClosedOrder(closedToPublish, ToRemoveOrderIdCh)
}

opensToPublish, closedToPublish, feeToPublish = collectOrdersToPublish(
marketData.tradesToPublish,
marketData.orderChanges,
marketData.orderInfos,
marketData.feeHolder,
marketData.timestamp)
addClosedOrder(closedToPublish, ToRemoveOrderIdCh)

// ToRemoveOrderIdCh would be only used in production code
// will be nil in mock (pressure testing, local publisher) and test code
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var (
Version string
)

const NodeVersion = "0.7.2"
const NodeVersion = "0.7.2-hf.1"

func init() {
Version = fmt.Sprintf("Binance Chain Release: %s;", NodeVersion)
Expand Down

0 comments on commit 82e2af8

Please sign in to comment.