From 33cae226e41582512e276bfb68233f1f2506d4be Mon Sep 17 00:00:00 2001 From: Nate Maninger Date: Sun, 5 May 2024 14:35:26 -0700 Subject: [PATCH] ipfs: rate limit reprovide --- ipfs/provide.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipfs/provide.go b/ipfs/provide.go index ba25761..b5e94f5 100644 --- a/ipfs/provide.go +++ b/ipfs/provide.go @@ -57,7 +57,7 @@ func (r *Reprovider) Run(ctx context.Context, interval time.Duration) { } for { - cids, err := r.store.ProvideCIDs(256) + cids, err := r.store.ProvideCIDs(1000) if err != nil { r.log.Error("failed to fetch CIDs to provide", zap.Error(err)) break @@ -98,6 +98,8 @@ func (r *Reprovider) Run(ctx context.Context, interval time.Duration) { } r.log.Debug("announced CIDs", zap.Int("count", len(announced)), zap.Stringers("cids", announced)) + // sleep a bit to rate limit. A little under 5 minutes per million + time.Sleep(250 * time.Millisecond) } } })