From 82e2af8d5351fd14a24a3ee6fae5f49978b85ed5 Mon Sep 17 00:00:00 2001 From: erhenglu <42333959+erhenglu@users.noreply.github.com> Date: Tue, 14 Jul 2020 16:22:56 +0800 Subject: [PATCH] remove orderInfo from orderInfoForPub when publish anything (#766) * add closed orders to ToRemoveOrderIdCh when ShouldPublishAny=true --- CHANGELOG.md | 3 +++ app/app.go | 1 + app/pub/metrics.go | 7 +++++++ app/pub/publisher.go | 17 ++++++++--------- version/version.go | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ea6d698..a3d1cba3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/app/app.go b/app/app.go index f5e883bb3..067b54e82 100644 --- a/app/app.go +++ b/app/app.go @@ -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, diff --git a/app/pub/metrics.go b/app/pub/metrics.go index c764fe70a..869d9d011 100644 --- a/app/pub/metrics.go +++ b/app/pub/metrics.go @@ -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. @@ -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{}), } } diff --git a/app/pub/publisher.go b/app/pub/publisher.go index eb17b44c4..653ec0f0d 100644 --- a/app/pub/publisher.go +++ b/app/pub/publisher.go @@ -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 diff --git a/version/version.go b/version/version.go index 2ef5e4e5b..f0c801353 100644 --- a/version/version.go +++ b/version/version.go @@ -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)