diff --git a/src/main/java/org/opensearch/timeseries/transport/ResultProcessor.java b/src/main/java/org/opensearch/timeseries/transport/ResultProcessor.java index 7b3424d69..2b7ebca65 100644 --- a/src/main/java/org/opensearch/timeseries/transport/ResultProcessor.java +++ b/src/main/java/org/opensearch/timeseries/transport/ResultProcessor.java @@ -229,6 +229,9 @@ class PageListener implements ActionListener { @Override public void onResponse(CompositeRetriever.Page entityFeatures) { + // Increment pagesInFlight to track the processing of this page + pagesInFlight.incrementAndGet(); + // start processing next page after sending out features for previous page if (pageIterator.hasNext()) { pageIterator.next(this); @@ -236,9 +239,6 @@ public void onResponse(CompositeRetriever.Page entityFeatures) { scheduleImputeHCTask(); } - // Increment pagesInFlight to track the processing of this page - pagesInFlight.incrementAndGet(); - if (entityFeatures != null && false == entityFeatures.isEmpty()) { LOG .info(