prevent search requests to closed indices from breaking segmented results

This commit is contained in:
Spencer Alger 2014-08-04 14:28:25 -07:00
parent 9f280efad1
commit da08ac9bec
2 changed files with 21 additions and 7 deletions

View file

@ -80,10 +80,23 @@ define(function (require) {
ignoreUnavailable: true,
body: state.body
})
.catch(function (err) {
if (err.status === 403 && err.message.match(/ClusterBlockException.+index closed/)) {
return false;
} else {
throw err;
}
})
.then(function (resp) {
// abort if fetch is called twice quickly
if (req !== activeReq) return;
// a response was swallowed intentionally. Move to next index
if (!resp) {
if (queue.length) return recurse();
else return done();
}
var start; // promise that starts the chain
if (i > 0) {
@ -119,18 +132,20 @@ define(function (require) {
})
.then(function () {
if (queue.length) return recurse();
req.complete = true;
req.ms = req.moment.diff() * -1;
req.source.activeFetchCount -= 1;
return (i + 1);
return done();
});
});
}());
})
.then(req.defer.resolve, req.defer.reject);
function done() {
req.complete = true;
req.ms = req.moment.diff() * -1;
req.source.activeFetchCount -= 1;
return (i + 1);
}
return req.defer.promise;
};

View file

@ -243,7 +243,6 @@ define(function (require) {
each: notify.timed('handle each segment', function (resp, req) {
var rows = $scope.rows;
var counts = rows.fieldCounts;
var rebuildFieldCounts = false;
// merge the rows and the hits, use a new array to help watchers
rows = $scope.rows = rows.concat(resp.hits.hits);