From 2d7a9b055141c262bc279a5796e21c9578deae86 Mon Sep 17 00:00:00 2001 From: Fridrik Asmundsson Date: Mon, 18 Sep 2023 15:43:01 +0000 Subject: [PATCH] Moved work duration to a constant --- blockstore/splitstore/splitstore_compact.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/blockstore/splitstore/splitstore_compact.go b/blockstore/splitstore/splitstore_compact.go index e6fb2ab38..47caca886 100644 --- a/blockstore/splitstore/splitstore_compact.go +++ b/blockstore/splitstore/splitstore_compact.go @@ -66,8 +66,9 @@ var ( ) const ( - batchSize = 16384 - cidKeySize = 128 + batchSize = 16384 + cidKeySize = 128 + purgeWorkSliceDuration = time.Second ) func (s *SplitStore) HeadChange(_, apply []*types.TipSet) error { @@ -1381,8 +1382,8 @@ func (s *SplitStore) purge(coldr *ColdSetReader, checkpoint *Checkpoint, markSet // requires write access to txnLk that may starve other operations that require // access to the blockstore. elapsed := time.Since(now) - if elapsed > time.Second { - // work 1 second, sleep 4, or 20% utilization + if elapsed > purgeWorkSliceDuration { + // work 1 slice, sleep 4 slices, or 20% utilization time.Sleep(4 * elapsed) now = time.Now() }