namesys: extract DefaultRecortTTL to a variable

License: MIT
Signed-off-by: default avatarJakub Sztandera <kubuxu@protonmail.ch>
parent b558012d
...@@ -93,7 +93,7 @@ func (ns *mpns) Publish(ctx context.Context, name ci.PrivKey, value path.Path) e ...@@ -93,7 +93,7 @@ func (ns *mpns) Publish(ctx context.Context, name ci.PrivKey, value path.Path) e
if err != nil { if err != nil {
return err return err
} }
ns.addToDHTCache(name, value, time.Now().Add(time.Hour*24)) ns.addToDHTCache(name, value, time.Now().Add(DefaultRecortTTL))
return nil return nil
} }
......
...@@ -33,6 +33,7 @@ var ErrExpiredRecord = errors.New("expired record") ...@@ -33,6 +33,7 @@ var ErrExpiredRecord = errors.New("expired record")
var ErrUnrecognizedValidity = errors.New("unrecognized validity type") var ErrUnrecognizedValidity = errors.New("unrecognized validity type")
var PublishPutValTimeout = time.Minute var PublishPutValTimeout = time.Minute
var DefaultRecortTTL = 24 * time.Hour
// ipnsPublisher is capable of publishing and resolving names to the IPFS // ipnsPublisher is capable of publishing and resolving names to the IPFS
// routing system. // routing system.
...@@ -53,7 +54,7 @@ func NewRoutingPublisher(route routing.ValueStore, ds ds.Datastore) *ipnsPublish ...@@ -53,7 +54,7 @@ func NewRoutingPublisher(route routing.ValueStore, ds ds.Datastore) *ipnsPublish
// and publishes it out to the routing system // and publishes it out to the routing system
func (p *ipnsPublisher) Publish(ctx context.Context, k ci.PrivKey, value path.Path) error { func (p *ipnsPublisher) Publish(ctx context.Context, k ci.PrivKey, value path.Path) error {
log.Debugf("Publish %s", value) 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 // PublishWithEOL is a temporary stand in for the ipns records implementation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment