From d1f654148f98772352f9faa21dbc7fb85614ee84 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Mon, 25 Nov 2024 18:03:42 +0100 Subject: [PATCH] fix: increase provider sample size (#10589) --- core/node/provider.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/node/provider.go b/core/node/provider.go index 7f37cd8b1a4..d6ab26b0c0d 100644 --- a/core/node/provider.go +++ b/core/node/provider.go @@ -14,8 +14,12 @@ import ( "go.uber.org/fx" ) +// The size of a batch that will be used for calculating average announcement +// time per CID, inside of boxo/provider.ThroughputReport +// and in 'ipfs stats provide' report. +const sampledBatchSize = 1000 + func ProviderSys(reprovideInterval time.Duration, acceleratedDHTClient bool) fx.Option { - const magicThroughputReportCount = 128 return fx.Provide(func(lc fx.Lifecycle, cr irouting.ProvideManyRouter, keyProvider provider.KeyChanFunc, repo repo.Repo, bs blockstore.Blockstore) (provider.System, error) { opts := []provider.Option{ provider.Online(cr), @@ -105,7 +109,7 @@ https://github.com/ipfs/kubo/blob/master/docs/config.md#routingaccelerateddhtcli keysProvided, avgProvideSpeed, count, avgProvideSpeed*time.Duration(count), reprovideInterval) } return false - }, magicThroughputReportCount)) + }, sampledBatchSize)) } sys, err := provider.New(repo.Datastore(), opts...) if err != nil {