Reset ServerSession#isComplete in response to websocket updates.

BUG=https://code.google.com/p/camlistore/issues/detail?id=333

Change-Id: Ia6ac92254bdaadfe9b8df2d7242d9bfb61539d63
This commit is contained in:
Aaron Boodman 2014-01-10 21:20:47 -08:00
parent 197f6492f5
commit 646cda0c24
1 changed files with 3 additions and 4 deletions

View File

@ -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() {