Skip to content

Commit b2690c7

Browse files
vasco-santosjacobheun
authored andcommittedDec 1, 2019
fix: async it refs (#19)
* fix: async it refs * chore: add return
1 parent 31b26bc commit b2690c7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
},
2020
"devDependencies": {
2121
"aegir": "^20.4.1",
22-
"async-iterator-all": "^1.0.0",
2322
"chai": "^4.2.0",
2423
"cids": "^0.7.1",
2524
"go-ipfs-dep": "~0.4.22",
2625
"ipfsd-ctl": "~0.47.4",
2726
"peer-id": "~0.13.5"
2827
},
2928
"dependencies": {
29+
"async-iterator-all": "^1.0.0",
3030
"debug": "^4.1.1",
3131
"ipfs-http-client": "^40.0.1",
3232
"multiaddr": "^7.2.1",

‎src/index.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
'use strict'
22

3+
const debug = require('debug')
4+
35
const dht = require('ipfs-http-client/src/dht')
46
const refs = require('ipfs-http-client/src/refs')
57
const getEndpointConfig = require('ipfs-http-client/src/get-endpoint-config')
8+
69
const { default: PQueue } = require('p-queue')
7-
const debug = require('debug')
10+
const all = require('async-iterator-all')
811

912
const log = debug('libp2p-delegated-content-routing')
1013
log.error = debug('libp2p-delegated-content-routing:error')
@@ -89,10 +92,10 @@ class DelegatedContentRouting {
8992
async provide (key) {
9093
const keyString = key.toBaseEncodedString()
9194
log('provide starts: ' + keyString)
92-
await this._httpQueueRefs.add(() =>
93-
this.refs(keyString, { recursive: false })
95+
const results = await this._httpQueueRefs.add(() =>
96+
all(this.refs(keyString, { recursive: false }))
9497
)
95-
log('provide finished: ' + keyString)
98+
log('provide finished: ', keyString, results)
9699
}
97100
}
98101

0 commit comments

Comments
 (0)
Please sign in to comment.