Skip to content

Commit

Permalink
Don't lock in Get
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Jan 12, 2022
1 parent 893998c commit 3464dc2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions blockstore/autobatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ func (bs *AutobatchBlockstore) Shutdown(ctx context.Context) error {
}

func (bs *AutobatchBlockstore) Get(ctx context.Context, c cid.Cid) (block.Block, error) {
bs.stateLock.Lock()
defer bs.stateLock.Unlock()
// may seem backward to check the backingBs first, but that is the likeliest case
blk, err := bs.backingBs.Get(ctx, c)
if err == nil {
Expand All @@ -174,7 +172,7 @@ func (bs *AutobatchBlockstore) Get(ctx context.Context, c cid.Cid) (block.Block,
return v, nil
}

return nil, ErrNotFound
return bs.Get(ctx, c)
}

func (bs *AutobatchBlockstore) DeleteBlock(context.Context, cid.Cid) error {
Expand Down

0 comments on commit 3464dc2

Please sign in to comment.