Skip to content

Commit 34a401e

Browse files
committed
simplify
1 parent 6f7198b commit 34a401e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/async/AsyncResultsService.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,11 @@ private void getSearchResponseFromTask(
117117
if (expirationTimeMillis != -1) {
118118
task.setExpirationTime(expirationTimeMillis);
119119
}
120-
boolean added = addCompletionListener.apply(task, listener.delegateFailure((l, response) -> {
121-
// If the task expiration is updated after the document was created with an earlier expiration time,
122-
// we should TRY to update the document's expiration time here.
123-
if (updateInitialResultsInStore == false && expirationTimeMillis != -1) {
124-
store.updateExpirationTime(
125-
searchId.getDocId(),
126-
expirationTimeMillis,
127-
ActionListener.running(() -> sendFinalResponse(request, response, nowInMillis, l))
128-
);
129-
} else {
130-
sendFinalResponse(request, response, nowInMillis, l);
131-
}
132-
}), request.getWaitForCompletionTimeout());
120+
boolean added = addCompletionListener.apply(
121+
task,
122+
listener.delegateFailure((l, response) -> sendFinalResponse(request, response, nowInMillis, l)),
123+
request.getWaitForCompletionTimeout()
124+
);
133125
if (added == false) {
134126
// the task must have completed, since we cannot add a completion listener
135127
assert store.getTaskAndCheckAuthentication(taskManager, searchId, asyncTaskClass) == null;

0 commit comments

Comments
 (0)