diff --git a/pin.go b/pin.go index 726c627294b95a671c1e6cf0134f79a6a206d62b..4d17138ab8a1b93513993fd4f2e069b055f7178c 100644 --- a/pin.go +++ b/pin.go @@ -5,6 +5,7 @@ package pin import ( "fmt" "sync" + "time" ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore" context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context" @@ -242,7 +243,9 @@ func LoadPinner(d ds.ThreadSafeDatastore, dserv mdag.DAGService) (Pinner, error) rootKey := key.Key(rootKeyBytes) - ctx := context.TODO() + ctx, cancel := context.WithTimeout(context.TODO(), time.Second*5) + defer cancel() + root, err := dserv.Get(ctx, rootKey) if err != nil { return nil, fmt.Errorf("cannot find pinning root object: %v", err) diff --git a/set_test.go b/set_test.go index ce15df0f76b2f489b1d322a5d4ec912d359f89ca..83af0778000c6a4d01381345a4d46e67d9a9423d 100644 --- a/set_test.go +++ b/set_test.go @@ -6,12 +6,12 @@ import ( "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore" dssync "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync" + "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context" "github.com/ipfs/go-ipfs/blocks/blockstore" "github.com/ipfs/go-ipfs/blocks/key" "github.com/ipfs/go-ipfs/blockservice" "github.com/ipfs/go-ipfs/exchange/offline" "github.com/ipfs/go-ipfs/merkledag" - "golang.org/x/net/context" ) func ignoreKeys(key.Key) {}