Skip to content

Commit

Permalink
add reprovide buffer for better batching
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed May 13, 2024
1 parent 4e8ac2a commit 370700b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ipfs/provide.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ func (r *Reprovider) Run(ctx context.Context, interval, timeout time.Duration, b

announced := make([]cid.Cid, 0, len(cids))
keys := make([]multihash.Multihash, 0, len(cids))
minAnnouncement := time.Now().Add(-interval)
// include a slight buffer for CIDs that are about to expire
// so they will be provided as one batch
buffer := interval / 10
minAnnouncement := time.Now().Add(-interval).Add(buffer)
for _, c := range cids {
// only provide CIDs that have not been provided within the
// last interval
Expand Down

0 comments on commit 370700b

Please sign in to comment.