Skip to content

Commit

Permalink
Skip call to ccr stats api if follower index is paused (#30027)
Browse files Browse the repository at this point in the history
  • Loading branch information
jen-huang authored Feb 5, 2019
1 parent 63075cc commit 84ee70e
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,21 @@ export const registerFollowerIndexRoutes = (server) => {
throw(error);
}

const {
indices: followerIndicesStats
} = await callWithRequest('ccr.followerIndexStats', { id });
// If this follower is paused, skip call to ES stats api since it will return 404
if(followerIndexInfo.status === 'paused') {
return deserializeFollowerIndex({
...followerIndexInfo
});
} else {
const {
indices: followerIndicesStats
} = await callWithRequest('ccr.followerIndexStats', { id });

return deserializeFollowerIndex({
...followerIndexInfo,
...(followerIndicesStats ? followerIndicesStats[0] : {})
});
return deserializeFollowerIndex({
...followerIndexInfo,
...(followerIndicesStats ? followerIndicesStats[0] : {})
});
}
} catch(err) {
if (isEsError(err)) {
throw wrapEsError(err);
Expand Down

0 comments on commit 84ee70e

Please sign in to comment.