Skip to content

Commit

Permalink
ipfs: only provide CIDs that have expired
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed May 13, 2024
1 parent e96ac5d commit 4e8ac2a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ipfs/provide.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ 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)
for _, c := range cids {
// only provide CIDs that have not been provided within the
// last interval
if c.LastAnnouncement.After(minAnnouncement) {
break
}
keys = append(keys, c.CID.Hash())
announced = append(announced, c.CID)
}
Expand Down

0 comments on commit 4e8ac2a

Please sign in to comment.