Merge pull request #7276 from ipfs/patch-0.5.1/7244

IPNS timeout patch from master
This commit is contained in:
Adin Schmahmann 2020-05-05 17:16:05 -04:00 committed by GitHub
commit ae53665173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,6 @@ import (
const ipnsPrefix = "/ipns/"
const PublishPutValTimeout = time.Minute
const DefaultRecordEOL = 24 * time.Hour
// IpnsPublisher is capable of publishing and resolving names to the IPFS
@ -269,15 +268,10 @@ func PublishPublicKey(ctx context.Context, r routing.ValueStore, k string, pubk
}
// Store associated public key
timectx, cancel := context.WithTimeout(ctx, PublishPutValTimeout)
defer cancel()
return r.PutValue(timectx, k, pkbytes)
return r.PutValue(ctx, k, pkbytes)
}
func PublishEntry(ctx context.Context, r routing.ValueStore, ipnskey string, rec *pb.IpnsEntry) error {
timectx, cancel := context.WithTimeout(ctx, PublishPutValTimeout)
defer cancel()
data, err := proto.Marshal(rec)
if err != nil {
return err
@ -285,7 +279,7 @@ func PublishEntry(ctx context.Context, r routing.ValueStore, ipnskey string, rec
log.Debugf("Storing ipns entry at: %s", ipnskey)
// Store ipns entry at "/ipns/"+h(pubkey)
return r.PutValue(timectx, ipnskey, data)
return r.PutValue(ctx, ipnskey, data)
}
// InitializeKeyspace sets the ipns record for the given key to