git ssb

16+

cel / patchfoo



Commit 24417ffb7f896971664053a13101154e40d6adce

Optimize streaming my channels

cel committed on 5/12/2017, 6:26:52 AM
Parent: 9ebb886a032f3a3767c24dce9a343311ea8c4481

Files changed

lib/app.jschanged
lib/app.jsView
@@ -282,8 +282,26 @@
282282 )
283283 }
284284
285285 App.prototype.streamMyChannels = function (id, opts) {
286 + // use ssb-query plugin if it is available, since it has an index for
287 + // author + type
288 + if (this.sbot.query) return pull(
289 + this.sbot.query.read({
290 + reverse: true,
291 + query: [
292 + {$filter: {
293 + value: {
294 + author: id,
295 + content: {type: 'channel', subscribed: true}
296 + }
297 + }},
298 + {$map: ['value', 'content', 'channel']}
299 + ]
300 + }),
301 + pull.unique()
302 + )
303 +
286304 return pull(
287305 this.sbot.createUserStream({id: id, reverse: true}),
288306 this.unboxMessages(),
289307 pull.filter(function (msg) {

Built with git-ssb-web