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

Commit 232fc39

Browse files
committed
fix: pin walking
1 parent 280f987 commit 232fc39

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/core/components/pin/pin-set.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ exports = module.exports = function (dag) {
263263
// walk the links of this fanout bin
264264
return dag.get(linkHash, '', { preload: false }, (err, res) => {
265265
if (err) { return eachCb(err) }
266-
pinSet.walkItems(res.value, stepBin, eachCb)
266+
pinSet.walkAll(res.value, stepPin, stepBin, eachCb)
267267
})
268268
}
269269
} else {

test/core/pin-set.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,21 @@ describe('pinSet', function () {
197197
it('visits all links of a root node', function (done) {
198198
this.timeout(90 * 1000)
199199

200-
const seen = []
201-
const walker = (link, idx, data) => seen.push({ link, idx, data })
200+
const seenPins = []
201+
const walkerPin = (link, idx, data) => seenPins.push({ link, idx, data })
202+
const seenBins = []
203+
const walkerBin = (link, idx, data) => seenBins.push({ link, idx, data })
202204

203205
createNodes(maxItems + 1, (err, nodes) => {
204206
expect(err).to.not.exist()
205207

206208
pinSet.storeSet(nodes, (err, result) => {
207209
expect(err).to.not.exist()
208210

209-
pinSet.walkAll(result.node, () => {}, walker, err => {
211+
pinSet.walkAll(result.node, walkerPin, walkerBin, err => {
210212
expect(err).to.not.exist()
211-
expect(seen).to.have.length(maxItems + defaultFanout + 1)
213+
expect(seenPins).to.have.length(maxItems + 1)
214+
expect(seenBins).to.have.length(defaultFanout)
212215
done()
213216
})
214217
})

0 commit comments

Comments
 (0)