Skip to content

Commit

Permalink
[ML] Persist data counts on job close before results index refresh
Browse files Browse the repository at this point in the history
On job close we aim to refresh the results index before returning
so that the caller knows that all results are searchable.

It turns out that we were writing the final data counts _after_
refreshing the indices, so that a user who searched for final
data counts immediately after receiving the `_close` response
would potentially get inaccurate data counts.

This change writes the final data counts before refreshing the
indices.
  • Loading branch information
droberts195 committed Oct 19, 2023
1 parent cfa11d2 commit f3b554e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public void close() {
killProcess(false, false);
stateStreamer.cancel();
}
dataCountsReporter.writeUnreportedCounts();
autodetectResultProcessor.awaitCompletion();
} finally {
onFinishHandler.accept(null, true);
Expand All @@ -180,7 +181,6 @@ public void close() {
try {
future.get();
autodetectWorkerExecutor.shutdownNow();
dataCountsReporter.writeUnreportedCounts();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
Expand Down

0 comments on commit f3b554e

Please sign in to comment.