From 41357efef02a01d262d10993f0e540080652da2d Mon Sep 17 00:00:00 2001 From: ykomissarov Date: Thu, 9 Jan 2020 18:09:50 +0300 Subject: [PATCH] fix concurrent read --- accounting/accounting.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/accounting/accounting.go b/accounting/accounting.go index b5d9469..badd084 100644 --- a/accounting/accounting.go +++ b/accounting/accounting.go @@ -90,8 +90,10 @@ func (w *accountingWorker) init(accountingSetting conf.Accounting) { } func (w *accountingWorker) takeSnapshot() []entity.Snapshot { - response := make([]entity.Snapshot, 0, len(w.accountingStorage)) - for appId, account := range w.accountingStorage { + lastStorage := w.accountingStorage + + response := make([]entity.Snapshot, 0, len(lastStorage)) + for appId, account := range lastStorage { limitState, version := account.Snapshot()