ipfs / ipfs/js-ipfs-bitswap

Improve resilience of findAndConnect

Open
#226 1 comment 1 reaction 0 assignees View on GitHub
effort/hours exp/novice help wanted kind/bug need/triage P3 status/ready
Dominant language
TypeScript
Stars
75
Forks
43
PR merge metrics
No merged PRs in 30d

Description

Currently findAndConnect uses Promise.all to connect to all found providers, https://github.com/ipfs/js-ipfs-bitswap/blob/v1.0.0/src/network.js#L137. If we find multiple providers and for some reason fail to connect to 1 of them, findAndConnect will fail.

In reality we probably only need at least 1 to succeed so it might be better to use something like [Promise.allSettled](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) to avoid unnecessary failures.

The other promises aren't being aborted at the moment so it looks like this should still connect to available peers. As such, this likely isn't a big issue at the moment, but it should still be fixed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.