From 5d5ef57c8c01904c21d180c8d6773d4148b9ef8b Mon Sep 17 00:00:00 2001 From: capossele <angelocapossele@gmail.com> Date: Wed, 17 Jun 2020 09:49:19 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20some=20bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/metrics/fpc.go | 2 +- plugins/metrics/plugin.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/metrics/fpc.go b/plugins/metrics/fpc.go index 544c39cf..fbfb823b 100644 --- a/plugins/metrics/fpc.go +++ b/plugins/metrics/fpc.go @@ -70,7 +70,7 @@ func FPCOpinionQueryReplyErrors() uint64 { //// logic broken into "process..." functions to be able to write unit tests //// -func processRoundStats(stats vote.RoundStats) { +func processRoundStats(stats *vote.RoundStats) { // get the number of active conflicts numActive := (uint64)(len(stats.ActiveVoteContexts)) atomic.StoreUint64(&activeConflicts, numActive) diff --git a/plugins/metrics/plugin.go b/plugins/metrics/plugin.go index a1ea6a7f..ca67ba43 100644 --- a/plugins/metrics/plugin.go +++ b/plugins/metrics/plugin.go @@ -32,6 +32,9 @@ var log *logger.Logger func configure(_ *node.Plugin) { log = logger.NewLogger(PluginName) +} + +func run(_ *node.Plugin) { //// Events declared in other packages which we want to listen to here //// @@ -52,7 +55,7 @@ func configure(_ *node.Plugin) { })) // FPC round executed - valuetransfers.Voter().Events().RoundExecuted.Attach(events.NewClosure(func(roundStats vote.RoundStats) { + valuetransfers.Voter().Events().RoundExecuted.Attach(events.NewClosure(func(roundStats *vote.RoundStats) { processRoundStats(roundStats) })) @@ -107,9 +110,7 @@ func configure(_ *node.Plugin) { metrics.Events().QueryReplyError.Attach(events.NewClosure(func(ev *metrics.QueryReplyErrorEvent) { processQueryReplyError(ev) })) -} -func run(_ *node.Plugin) { // create a background worker that "measures" the MPS value every second if err := daemon.BackgroundWorker("Metrics Updater", func(shutdownSignal <-chan struct{}) { timeutil.Ticker(func() { -- GitLab