-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add reprovide #2785
feat: add reprovide #2785
Conversation
Adds a reprovide queue to kad-dht to republish provider records two hours before they would expire. Adds a function to the content routing interface to cancel the reprovide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few comments
packages/kad-dht/src/reprovider.ts
Outdated
this.log('nothing to delete') | ||
} | ||
|
||
this.log('Cleanup successful (%dms)', Date.now() - start) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be emitting metrics for this? I know kubo has had a lot of issues with reprovide time, we may want to get ahead of any potential issues with some metrics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual re-providing is done in a queue which has metrics for it's length, in-flight tasks, etc. I think this should be good enough to start with, we can always add more in future?
@@ -15,15 +15,21 @@ export const MAX_RECORD_AGE = 36 * hour | |||
|
|||
export const PROTOCOL = '/ipfs/kad/1.0.0' | |||
|
|||
export const RECORD_KEY_PREFIX = '/dht/record' | |||
export const PROVIDERS_VALIDITY = 24 * hour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit late to the party, but isn't this 48 hours
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would seem so, can haz PR?
this.log.trace('re-provided %c', cid) | ||
}, { | ||
signal: this.shutdownController?.signal, | ||
cid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you pass in the cid if you have it via the closure?
// reprovide | ||
await this.reprovide(options.cid, options) | ||
} finally { | ||
this.reprovideTimeout.cleanUp(signal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This runs irrespective of whether the reprovide for the CID succeeds. Is that a problem?
Increase provider record validity duration based on spec as discussed in #2785 --------- Co-authored-by: Daniel N <[email protected]> Co-authored-by: Alex Potsides <[email protected]>
Adds a reprovide queue to kad-dht to republish provider records two hours before they would expire.
Adds a function to the content routing interface to cancel the reprovide.
Change checklist