From 16278892d8f2135d39f60e77c32a2817cb6413ca Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 5 Nov 2015 13:26:16 +0000 Subject: [PATCH] Modify how detection of the end of pagination is done Synapse may filter down the events resulting in < 'limit' events being returned *but it still has more events*. Change the check to see if the request returned an empty array instead. This may add an extra HTTP hit. --- lib/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 84213fbfe..96632ca63 100644 --- a/lib/client.js +++ b/lib/client.js @@ -1638,7 +1638,7 @@ MatrixClient.prototype.scrollback = function(room, limit, callback) { var matrixEvents = utils.map(res.chunk, _PojoToMatrixEventMapper(self)); room.addEventsToTimeline(matrixEvents, true); room.oldState.paginationToken = res.end; - if (res.chunk.length < limit) { + if (res.chunk.length === 0) { room.oldState.paginationToken = null; } self.store.storeEvents(room, matrixEvents, res.end, true);