Commit 7435396e3180a59a47f4a1e77896c4090816c5f4
Use pull.take
cel committed on 4/20/2017, 9:03:41 PMParent: b415e82d715287a48617deafbf2edff6d9ca48f1
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -177,18 +177,8 @@ | ||
177 | 177 … | }) |
178 | 178 … | ) |
179 | 179 … | } |
180 | 180 … | |
181 | - function take (n) { | |
182 | - return function (read) { | |
183 | - return function (abort, cb) { | |
184 | - //after n reads, tell the source to abort! | |
185 | - if(!n--) return read(true, cb) | |
186 | - read(null, cb) | |
187 | - } | |
188 | - } | |
189 | - } | |
190 | - | |
191 | 181 … | function serveFeeds(req, res, following, channelSubscriptions, feedId) { |
192 | 182 … | var opts = defaultOpts |
193 | 183 … | |
194 | 184 … | opts.marked = { |
@@ -210,9 +200,9 @@ | ||
210 | 200 … | return !msg.value || |
211 | 201 … | (msg.value.author in following || |
212 | 202 … | msg.value.content.channel in channelSubscriptions) |
213 | 203 … | }), |
214 | - take(100), | |
204 … | + pull.take(2), | |
215 | 205 … | pull.collect(function (err, logs) { |
216 | 206 … | if (err) return respond(res, 500, err.stack || err) |
217 | 207 … | res.writeHead(200, { |
218 | 208 … | 'Content-Type': ctype("html") |
Built with git-ssb-web