From 646cda0c24361b442c4cdfbf4c807ca08fc179a8 Mon Sep 17 00:00:00 2001 From: Aaron Boodman Date: Fri, 10 Jan 2014 21:20:47 -0800 Subject: [PATCH] Reset ServerSession#isComplete in response to websocket updates. BUG=https://code.google.com/p/camlistore/issues/detail?id=333 Change-Id: Ia6ac92254bdaadfe9b8df2d7242d9bfb61539d63 --- server/camlistored/ui/search_session.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/camlistored/ui/search_session.js b/server/camlistored/ui/search_session.js index a080389c4..e6a28403c 100644 --- a/server/camlistored/ui/search_session.js +++ b/server/camlistored/ui/search_session.js @@ -44,7 +44,6 @@ cam.SearchSession = function(connection, currentUri, query) { } }; this.instance_ = this.constructor.instanceCount_++; - this.isComplete_ = false; this.continuation_ = this.getContinuation_(this.constructor.SEARCH_SESSION_CHANGE_TYPE.NEW); this.socket_ = null; this.supportsWebSocket_ = false; @@ -99,7 +98,7 @@ cam.SearchSession.prototype.loadMoreResults = function() { // Returns true if it is known that all data which can be loaded for this query has been. cam.SearchSession.prototype.isComplete = function() { - return this.isComplete_; + return !this.continuation_; } cam.SearchSession.prototype.supportsChangeNotifications = function() { @@ -145,7 +144,7 @@ cam.SearchSession.prototype.searchDone_ = function(changeType, result) { if (result.continue) { this.continuation_ = this.getContinuation_(this.constructor.SEARCH_SESSION_CHANGE_TYPE.APPEND, result.continue); } else { - this.isComplete_ = true; + this.continuation_ = null; } this.dispatchEvent({type: this.constructor.SEARCH_SESSION_CHANGED, changeType: changeType}); @@ -165,7 +164,7 @@ cam.SearchSession.prototype.startSocketQuery_ = function() { this.socket_.close(); } - var query = this.connection_.buildQuery(this.query_, this.constructor.DESCRIBE_REQUEST, this.data_.blobs.length); + var query = this.connection_.buildQuery(this.query_, this.constructor.DESCRIBE_REQUEST, Math.max(this.data_.blobs.length, this.constructor.PAGE_SIZE_)); this.socket_ = new WebSocket(this.socketUri_.toString()); this.socket_.onopen = function() {