Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
fix roots query looping when less than limit results
Browse files Browse the repository at this point in the history
  • Loading branch information
mmckegg committed Jun 28, 2017
1 parent a6aab6f commit 60e61c2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sbot/roots.js
Expand Up @@ -150,15 +150,24 @@ module.exports = function (ssb, config) {

// TRUNCATE
if (typeof limit === 'number') {
var count = 0
return pullCat([
pull(
stream,
pull.take(limit)
pull.take(limit),
pull.through(() => {
count += 1
})
),

// send truncated marker for resuming search
pull.values([marker])
pull(
pull.values([marker]),
pull.filter(() => count === limit)
)
])
} else {
return stream
}
}
}
Expand Down

0 comments on commit 60e61c2

Please sign in to comment.