Skip to content

Commit 9cc766c

Browse files
authoredApr 16, 2020
fix: catch find providers error (#37)
* chore: update deps * fix: catch find providers error and log it * fix: pass correc timeout option * chore: update http client
1 parent 2e08fea commit 9cc766c

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed
 

‎package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@
1818
"coverage": "aegir coverage"
1919
},
2020
"devDependencies": {
21-
"aegir": "^21.4.5",
21+
"aegir": "^21.8.1",
2222
"chai": "^4.2.0",
2323
"cids": "^0.8.0",
2424
"go-ipfs-dep": "0.4.23-3",
25-
"ipfs-utils": "^1.2.1",
26-
"ipfsd-ctl": "^3.0.0",
25+
"ipfs-utils": "^2.2.0",
26+
"ipfsd-ctl": "^3.1.0",
2727
"it-drain": "^1.0.0",
2828
"it-last": "^1.0.1",
29-
"peer-id": "^0.13.7"
29+
"peer-id": "^0.13.11"
3030
},
3131
"dependencies": {
3232
"debug": "^4.1.1",
33-
"ipfs-http-client": "^43.0.1",
33+
"ipfs-http-client": "^44.0.0",
3434
"it-all": "^1.0.0",
35-
"multiaddr": "^7.2.1",
35+
"multiaddr": "^7.4.3",
3636
"p-defer": "^3.0.0",
37-
"p-queue": "^6.2.1",
38-
"peer-info": "^0.17.1"
37+
"p-queue": "^6.3.0",
38+
"peer-info": "^0.17.5"
3939
},
4040
"contributors": [
4141
"Jacob Heun <jacobheun@gmail.com>",

‎src/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,15 @@ class DelegatedContentRouting {
8383

8484
for await (const { id, addrs } of this.dht.findProvs(key, {
8585
numProviders: options.numProviders,
86-
searchParams: {
87-
timeout: `${options.timeout}ms` // The api requires specification of the time unit (s/ms)
88-
}
86+
timeout: options.timeout
8987
})) {
9088
const peerInfo = new PeerInfo(PeerId.createFromCID(id))
9189
addrs.forEach(addr => peerInfo.multiaddrs.add(addr))
9290
yield peerInfo
9391
}
92+
} catch (err) {
93+
log.error('findProviders errored:', err)
94+
throw err
9495
} finally {
9596
onFinish.resolve()
9697
log('findProviders finished:', keyString)

0 commit comments

Comments
 (0)
Please sign in to comment.