dag.get doesn't timeout
listenaddress opened this issue · 2 comments
Whether I ipfs.dag.get(cid) or ipfs.dag.get(cid, null, { timeout: '1s' }), the call hangs for 10+ minutes.
There's no timeout option for dag.get - https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/DAG.md#dagget
It certainly would be nice to have, but for the moment you can wrap the returned promise with the p-timeout module.
I think it's complicated by the fact that you can't cancel promises so even if you handle it at the top level with p-timeout, any requests initiated as part of the original dag.get will still be in flight, consuming resources.
The change would need to be made in the bitswap.getMany function and cascaded all the way back up through the block service, ipfs repo and ipld.
Fancy submitting a PR?
This is also a dupe of https://github.com/ipfs/interface-js-ipfs-core/issues/58 so discussion should take place there.