From a0430b6c1ec08e15dd9d093aef477733997f36d4 Mon Sep 17 00:00:00 2001 From: Massaki Archambault Date: Fri, 24 Dec 2021 15:58:38 -0500 Subject: [PATCH] fix lock value copy bug --- exporter.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/exporter.go b/exporter.go index ef1bc6a..343839f 100644 --- a/exporter.go +++ b/exporter.go @@ -45,11 +45,12 @@ func NewExporter(accountAddress []string) (*Exporter, error) { // Account represents a helium account type Account struct { Address string - UpdateLock sync.Mutex LastUpdate time.Time RewardsTotal map[string]int Tx AccountTx Hotspots map[string]Hotspot + + UpdateLock *sync.Mutex } func NewAccount(address string) Account { @@ -67,6 +68,8 @@ func NewAccount(address string) Account { WithdrawalTotal: 0, }, Hotspots: map[string]Hotspot{}, + + UpdateLock: &sync.Mutex{}, } } @@ -78,9 +81,10 @@ type AccountTx struct { // Hotspot represents a hotspot type Hotspot struct { Address string - UpdateLock sync.Mutex LastUpdate time.Time RewardsTotal map[string]int + + UpdateLock *sync.Mutex } func NewHotspot(address string) Hotspot { @@ -93,6 +97,8 @@ func NewHotspot(address string) Hotspot { "poc_challengees": 0, "poc_witnesses": 0, }, + + UpdateLock: &sync.Mutex{}, } }