Skip to content
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

fix: increase providers validity to 48 hours #2801

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions packages/kad-dht/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
// MaxRecordAge specifies the maximum time that any node will hold onto a record
// from the time its received. This does not apply to any other forms of validity that
// the record may contain.
// For example, a record may contain an ipns entry with an EOL saying its valid
// until the year 2020 (a great time in the future). For that record to stick around
// it must be rebroadcasted more frequently than once every 'MaxRecordAge'

import { KEEP_ALIVE } from '@libp2p/interface'

export const second = 1000
Expand All @@ -15,7 +8,10 @@ export const MAX_RECORD_AGE = 36 * hour

export const PROTOCOL = '/ipfs/kad/1.0.0'

export const PROVIDERS_VALIDITY = 24 * hour
/**
* @see https://github.com/libp2p/specs/blob/master/kad-dht/README.md#content-provider-advertisement-and-discovery
*/
export const PROVIDERS_VALIDITY = 48 * hour

export const PROVIDERS_CLEANUP_INTERVAL = hour

Expand Down
6 changes: 3 additions & 3 deletions packages/kad-dht/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,21 +377,21 @@ export interface ReProvideInit {
/**
* How long before the record expiry to re-provide in ms
*
* @default 7200000
* @default 7200000 (2 hours)
*/
threshold?: number

/**
* How often to check which records need reproviding in ms
*
* @default 3600000
* @default 3600000 (1 hour)
*/
interval?: number

/**
* How long provider records are valid for in ms
*
* @default 86400000
* @default 172800000 (48 hours)
*/
validity?: number
}
Expand Down
Loading