diff --git a/provider/reprovider.go b/provider/reprovider.go index c5f356314..4fdba4f51 100644 --- a/provider/reprovider.go +++ b/provider/reprovider.go @@ -58,6 +58,7 @@ type reprovider struct { noReprovideInFlight chan struct{} maxReprovideBatchSize uint + acceleratedDHTClient bool statLk sync.Mutex totalProvides, lastReprovideBatchSize uint64 @@ -161,6 +162,13 @@ func Allowlist(allowlist verifcid.Allowlist) Option { } } +func AcceleratedDHTClient(v bool) Option { + return func(system *reprovider) error { + system.acceleratedDHTClient = v + return nil + } +} + func ReproviderInterval(duration time.Duration) Option { return func(system *reprovider) error { system.reprovideInterval = duration @@ -358,7 +366,9 @@ func (s *reprovider) run() { s.statLk.Lock() s.avgProvideDuration = (totalProvideTime + dur) / (time.Duration(s.totalProvides) + time.Duration(len(keys))) s.totalProvides += uint64(len(keys)) - s.lastRun = time.Now() + if s.acceleratedDHTClient { + s.lastRun = time.Now() + } log.Debugf("finished providing of %d keys. It took %v with an average of %v per provide", len(keys), dur, recentAvgProvideDuration)