From 2d37e6033484c0b79c2edb7911d1f0d80ad165f4 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 14 Dec 2016 20:50:04 +0100 Subject: [PATCH] namesys: extract DefaultRecortTTL to a variable License: MIT Signed-off-by: Jakub Sztandera --- namesys/namesys.go | 2 +- namesys/publisher.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/namesys/namesys.go b/namesys/namesys.go index 3fa72c332..8acc1dc2c 100644 --- a/namesys/namesys.go +++ b/namesys/namesys.go @@ -93,7 +93,7 @@ func (ns *mpns) Publish(ctx context.Context, name ci.PrivKey, value path.Path) e if err != nil { return err } - ns.addToDHTCache(name, value, time.Now().Add(time.Hour*24)) + ns.addToDHTCache(name, value, time.Now().Add(DefaultRecortTTL)) return nil } diff --git a/namesys/publisher.go b/namesys/publisher.go index 795023c83..5f5a15abd 100644 --- a/namesys/publisher.go +++ b/namesys/publisher.go @@ -33,6 +33,7 @@ var ErrExpiredRecord = errors.New("expired record") var ErrUnrecognizedValidity = errors.New("unrecognized validity type") var PublishPutValTimeout = time.Minute +var DefaultRecortTTL = 24 * time.Hour // ipnsPublisher is capable of publishing and resolving names to the IPFS // routing system. @@ -53,7 +54,7 @@ func NewRoutingPublisher(route routing.ValueStore, ds ds.Datastore) *ipnsPublish // and publishes it out to the routing system func (p *ipnsPublisher) Publish(ctx context.Context, k ci.PrivKey, value path.Path) error { log.Debugf("Publish %s", value) - return p.PublishWithEOL(ctx, k, value, time.Now().Add(time.Hour*24)) + return p.PublishWithEOL(ctx, k, value, time.Now().Add(DefaultRecortTTL)) } // PublishWithEOL is a temporary stand in for the ipns records implementation