Skip to content

Commit

Permalink
ipfs: rate limit reprovide
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed May 5, 2024
1 parent f98693f commit 33cae22
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ipfs/provide.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
})
Expand Down

0 comments on commit 33cae22

Please sign in to comment.