Skip to content

Commit

Permalink
ipfs: add deadline to GetBlock()
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Mar 12, 2024
1 parent 5940398 commit 95e035e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ipfs/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func (n *Node) Close() error {

// GetBlock fetches a block from the IPFS network
func (n *Node) GetBlock(ctx context.Context, c cid.Cid) (format.Node, error) {
// it should never take more than a minute to fetch a single block
ctx, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
return n.dagService.Get(ctx, c)
}

Expand Down

0 comments on commit 95e035e

Please sign in to comment.