From 87d83ed7ebe33c79b4933b5f90ceca44e7e70b50 Mon Sep 17 00:00:00 2001 From: ldeffenb Date: Wed, 18 Aug 2021 09:19:08 -0400 Subject: [PATCH] fix: only flush dirty metrics (#2418) --- pkg/topology/kademlia/internal/metrics/metrics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/topology/kademlia/internal/metrics/metrics.go b/pkg/topology/kademlia/internal/metrics/metrics.go index 2ea7d7af66d..08096c0162d 100644 --- a/pkg/topology/kademlia/internal/metrics/metrics.go +++ b/pkg/topology/kademlia/internal/metrics/metrics.go @@ -164,7 +164,7 @@ type Counters struct { // flush writes the current state of in memory counters into the given db. func (cs *Counters) flush(db *shed.DB, batch *leveldb.Batch) error { - if cs.dirty.Load() > 1 { + if cs.dirty.Load() < 3 { return nil } cs.dirty.CAS(3, 2)