diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-05-11 20:25:59 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-05-11 20:26:52 -1000 |
commit | 24417ffb7f896971664053a13101154e40d6adce (patch) | |
tree | 11c11573e50c0ba17cd5a92a57e3b485b08f966e /lib | |
parent | 9ebb886a032f3a3767c24dce9a343311ea8c4481 (diff) | |
download | patchfoo-24417ffb7f896971664053a13101154e40d6adce.tar.gz patchfoo-24417ffb7f896971664053a13101154e40d6adce.zip |
Optimize streaming my channels
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.js | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -283,6 +283,24 @@ App.prototype.streamChannels = function (opts) { } App.prototype.streamMyChannels = function (id, opts) { + // use ssb-query plugin if it is available, since it has an index for + // author + type + if (this.sbot.query) return pull( + this.sbot.query.read({ + reverse: true, + query: [ + {$filter: { + value: { + author: id, + content: {type: 'channel', subscribed: true} + } + }}, + {$map: ['value', 'content', 'channel']} + ] + }), + pull.unique() + ) + return pull( this.sbot.createUserStream({id: id, reverse: true}), this.unboxMessages(), |