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

Increase provider Multiaddress TTL #795

Merged
Merged
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
15 changes: 11 additions & 4 deletions providers/providers_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ import (
"github.com/multiformats/go-base32"
)

// ProvidersKeyPrefix is the prefix/namespace for ALL provider record
// keys stored in the data store.
const ProvidersKeyPrefix = "/providers/"
const (
// ProvidersKeyPrefix is the prefix/namespace for ALL provider record
// keys stored in the data store.
ProvidersKeyPrefix = "/providers/"

// ProviderAddrTTL is the TTL to keep the multi addresses of provider
// peers around. This means we return those addresses alongside provider
// records and likely make the second DHT lookup for addresses obsolete.
ProviderAddrTTL = 24 * time.Hour
)

// ProvideValidity is the default time that a provider record should last
var ProvideValidity = time.Hour * 24
Expand Down Expand Up @@ -232,7 +239,7 @@ func (pm *ProviderManager) run(ctx context.Context, proc goprocess.Process) {
// AddProvider adds a provider
func (pm *ProviderManager) AddProvider(ctx context.Context, k []byte, provInfo peer.AddrInfo) error {
if provInfo.ID != pm.self { // don't add own addrs.
pm.pstore.AddAddrs(provInfo.ID, provInfo.Addrs, peerstore.ProviderAddrTTL)
pm.pstore.AddAddrs(provInfo.ID, provInfo.Addrs, ProviderAddrTTL)
guseggert marked this conversation as resolved.
Show resolved Hide resolved
}
prov := &addProv{
ctx: ctx,
Expand Down