diff --git a/packages/kad-dht/src/constants.ts b/packages/kad-dht/src/constants.ts index 3b08b18632..8290d846e8 100644 --- a/packages/kad-dht/src/constants.ts +++ b/packages/kad-dht/src/constants.ts @@ -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 @@ -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 diff --git a/packages/kad-dht/src/index.ts b/packages/kad-dht/src/index.ts index 10a660b0c6..ec5ae8ea04 100644 --- a/packages/kad-dht/src/index.ts +++ b/packages/kad-dht/src/index.ts @@ -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 }