Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 99911b1

Browse files
0x-r4bbitalanshaw
authored andcommitted
fix(dht): allow for options object in findProvs() API (#1457)
This is to complement: ipfs-inactive/interface-js-ipfs-core#337 Fixes #1322
1 parent 7860d0f commit 99911b1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/components/dht.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,19 @@ module.exports = (self) => {
5656
* @param {function(Error, Array<PeerInfo>)} [callback]
5757
* @returns {Promise<PeerInfo>|void}
5858
*/
59-
findprovs: promisify((key, callback) => {
59+
findprovs: promisify((key, opts, callback) => {
6060
if (typeof key === 'string') {
6161
key = new CID(key)
6262
}
6363

64-
self._libp2pNode.contentRouting.findProviders(key, callback)
64+
if (typeof opts === 'function') {
65+
callback = opts
66+
opts = {}
67+
}
68+
69+
opts = opts || {}
70+
71+
self._libp2pNode.contentRouting.findProviders(key, opts.timeout || null, callback)
6572
}),
6673

6774
/**

0 commit comments

Comments
 (0)