From 102c926ef3779ffab1e37cd454e3eab4e43ff98d Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Sun, 22 Sep 2019 20:06:52 +0300 Subject: [PATCH] core: don't print useless persist messages with nil errors Errors should be printed only when there are errors. --- pkg/core/blockchain.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 4fc630860..93991ff15 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -169,7 +169,9 @@ func (bc *Blockchain) Run(ctx context.Context) { case <-persistTimer.C: go func() { err := bc.Persist(ctx) - log.Warnf("failed to persist blockchain: %s", err) + if err != nil { + log.Warnf("failed to persist blockchain: %s", err) + } }() persistTimer.Reset(persistInterval) }