mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-02 03:28:25 +08:00
namesys: extract DefaultRecortTTL to a variable
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
@ -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")
|
|||||||
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
|
|||||||
// 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
|
||||||
|
Reference in New Issue
Block a user