git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit 60e61c2611fbf8281189ddd6fb823719a67a97e2

fix roots query looping when less than limit results

Matt McKegg committed on 6/28/2017, 9:10:05 AM
Parent: a6aab6f1d2a86e5cf04121dbc040f657ecdca01f

Files changed

sbot/roots.jschanged
sbot/roots.jsView
@@ -149,17 +149,26 @@
149149 )
150150
151151 // TRUNCATE
152152 if (typeof limit === 'number') {
153+ var count = 0
153154 return pullCat([
154155 pull(
155156 stream,
156- pull.take(limit)
157+ pull.take(limit),
158+ pull.through(() => {
159+ count += 1
160+ })
157161 ),
158162
159163 // send truncated marker for resuming search
160- pull.values([marker])
164+ pull(
165+ pull.values([marker]),
166+ pull.filter(() => count === limit)
167+ )
161168 ])
169+ } else {
170+ return stream
162171 }
163172 }
164173 }
165174

Built with git-ssb-web