diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-18 08:02:03 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-18 08:02:03 -1000 |
commit | a420cffdfbe0457bb07b9aff2778745929295f88 (patch) | |
tree | 9e0b383b59f2cbd0c2af9739673b7cd942391937 /lib | |
parent | 1440f7c6fce5e03dd6c65f4a2e2f81c7d400ca5f (diff) | |
download | patchfoo-a420cffdfbe0457bb07b9aff2778745929295f88.tar.gz patchfoo-a420cffdfbe0457bb07b9aff2778745929295f88.zip |
Improve pagination of sort=claimed stream forwards
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.js | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -274,10 +274,22 @@ App.prototype.pullGetMsg = function (id) { App.prototype.createLogStream = function (opts) { opts = opts || {} return opts.sortByTimestamp - ? this.sbot.createFeedStream(opts) + ? this.createFeedStream(opts) : this.sbot.createLogStream(opts) } +App.prototype.createFeedStream = function (opts) { + // work around opts.gt being treated as opts.gte sometimes + if (opts.gt && opts.limit && !opts.reverse) return pull( + this.sbot.createFeedStream(u.mergeOpts(opts, {limit: opts.limit + 1})), + pull.filter(function (msg) { + return msg && msg.value.timestamp !== opts.gt + }), + opts.limit && pull.take(opts.limit) + ) + return this.sbot.createFeedStream(opts) +} + var stateVals = { connected: 3, connecting: 2, |