From 7dd989bac2c337d5c26846af1e62063a3155c8b3 Mon Sep 17 00:00:00 2001 From: ykomissarov Date: Thu, 9 Jan 2020 18:48:02 +0300 Subject: [PATCH] fix rc --- accounting/accounting.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/accounting/accounting.go b/accounting/accounting.go index 3ffa543..ab2f215 100644 --- a/accounting/accounting.go +++ b/accounting/accounting.go @@ -79,11 +79,14 @@ func (w *accountingWorker) init(accountingSetting conf.Accounting) { newAccountingStorage[s.ApplicationId] = accounting newRequestsStoringStorage[s.ApplicationId] = s.EnableStoring } + w.requestsStoring = newRequestsStoringStorage + w.accountingStorage = newAccountingStorage InitStoringTask(accountingSetting.Storing) InitSnapshotTask(accountingSetting.SnapshotTimeout) + } else { + w.requestsStoring = newRequestsStoringStorage + w.accountingStorage = newAccountingStorage } - w.requestsStoring = newRequestsStoringStorage - w.accountingStorage = newAccountingStorage } func (w *accountingWorker) takeSnapshot() []entity.Snapshot { @@ -114,8 +117,8 @@ func (w *accountingWorker) recoveryAccounting(appId int32, limitStates map[strin log.Warn(log_code.ErrorSnapshotAccounting, err) } - if cash, ok := w.accountingStorage[appId]; ok { - cashLimitState, cashVersion := cash.Snapshot() + if cache, ok := w.accountingStorage[appId]; ok { + cashLimitState, cashVersion := cache.Snapshot() if dbSnapshot == nil || dbSnapshot.Version < cashVersion { version = cashVersion