Moved work duration to a constant

This commit is contained in:
Fridrik Asmundsson 2023-09-18 15:43:01 +00:00
parent 087d799547
commit 2d7a9b0551

View File

@ -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()
}