Skip to content

Commit

Permalink
use correct context in pubfunc pinning
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
  • Loading branch information
whyrusleeping committed Jan 11, 2016
1 parent 85852b5 commit 46b8ba8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,15 +475,15 @@ func (n *IpfsNode) loadFilesRoot() error {
dsk := ds.NewKey("/local/filesroot")
pf := func(ctx context.Context, k key.Key) error {
ds := n.Repo.Datastore()
if old, err := ds.Get(dsk); err == nil {
_ = n.Pinning.Unpin(n.Context(), key.Key(old.([]byte)), true)
if old, err := ds.Get(dsk); err == nil && old != nil {
_ = n.Pinning.Unpin(ctx, key.Key(old.([]byte)), true)
}
nnd, err := n.DAG.Get(n.Context(), k)
nnd, err := n.DAG.Get(ctx, k)
if err != nil {
return err
}

if err := n.Pinning.Pin(n.Context(), nnd, true); err != nil {
if err := n.Pinning.Pin(ctx, nnd, true); err != nil {
return err
}

Expand Down
1 change: 1 addition & 0 deletions mfs/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func Mkdir(r *Root, pth string, mkparents bool, flush bool) error {
func Lookup(r *Root, path string) (FSNode, error) {
dir, ok := r.GetValue().(*Directory)
if !ok {
log.Error("root not a dir: %#v", r.GetValue())
return nil, errors.New("root was not a directory")
}

Expand Down

0 comments on commit 46b8ba8

Please sign in to comment.