Skip to content

Commit

Permalink
reset and track the list of all and complete indices, fixing #433
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer Alger committed Sep 30, 2014
1 parent fecc255 commit cb59043
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/kibana/apps/discover/_segmented_fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ define(function (require) {
function segmentedFetch(searchSource) {
this.searchSource = searchSource;
this.queue = [];
this.completedQueue = [];
this.complete = [];
this.requestHandlers = {};
this.activeRequest = null;
this.notifyEvent = null;
Expand Down Expand Up @@ -125,8 +125,8 @@ define(function (require) {
if (!self.requestHandlers.status) return;

var status = {
total: self.queue.length,
complete: self.completedQueue.length,
total: self.all.length,
complete: self.complete.length,
remaining: self.queue.length,
active: active
};
Expand All @@ -147,7 +147,11 @@ define(function (require) {
queue = queue.reverse();
}

return self.queue = queue;
self.all = queue.slice(0);
self.queue = queue;
self.complete = [];

return queue;
};

segmentedFetch.prototype._createRequest = function () {
Expand Down Expand Up @@ -278,7 +282,7 @@ define(function (require) {
}
})
.then(function () {
self.completedQueue.push(index);
self.complete.push(index);
if (self.queue.length) return self._processQueue(req, state, remainingSize, loopCount);
return self._processQueueComplete(req, loopCount);
});
Expand Down

0 comments on commit cb59043

Please sign in to comment.