@cryptotaxi247 / kubo / commits / 2d37e6033

namesys: extract DefaultRecortTTL to a variable

License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Dec 14, 2016 at 20:50 UTC 2d37e6033484c0b79c2edb7911d1f0d80ad165f4
2 files changed +3 -2
namesys/namesys.go
+1 -1
@@ -93,7 +93,7 @@ func (ns *mpns) Publish(ctx context.Context, name ci.PrivKey, value path.Path) e
93 if err != nil {
94 return err
95 }
96 - ns.addToDHTCache(name, value, time.Now().Add(time.Hour*24))
96 + ns.addToDHTCache(name, value, time.Now().Add(DefaultRecortTTL))
97 return nil
98 }
99
namesys/publisher.go
+2 -1
@@ -33,6 +33,7 @@ var ErrExpiredRecord = errors.New("expired record")
33 var ErrUnrecognizedValidity = errors.New("unrecognized validity type")
34
35 var PublishPutValTimeout = time.Minute
36 +var DefaultRecortTTL = 24 * time.Hour
37
38 // ipnsPublisher is capable of publishing and resolving names to the IPFS
39 // routing system.
@@ -53,7 +54,7 @@ func NewRoutingPublisher(route routing.ValueStore, ds ds.Datastore) *ipnsPublish
54 // and publishes it out to the routing system
55 func (p *ipnsPublisher) Publish(ctx context.Context, k ci.PrivKey, value path.Path) error {
56 log.Debugf("Publish %s", value)
56 - return p.PublishWithEOL(ctx, k, value, time.Now().Add(time.Hour*24))
57 + return p.PublishWithEOL(ctx, k, value, time.Now().Add(DefaultRecortTTL))
58 }
59
60 // PublishWithEOL is a temporary stand in for the ipns records implementation