[7.x][ML] Use non-zero timeout when force stopping DF analytics (#56423) (#56428)

We have been using a zero timeout in the case that DF analytics
is stopped. This may cause a timeout when we cancel, for example,
the reindex task.

This commit fixes this by using the default timeout instead.

Backport of #56423
This commit is contained in:
Dimitris Athanasiou 2020-05-08 21:12:11 +03:00 committed by GitHub
parent bd4b9dd10e
commit 44ffa388ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -38,6 +38,7 @@ import org.elasticsearch.tasks.TaskResult;
import org.elasticsearch.xpack.core.ml.MlTasks;
import org.elasticsearch.xpack.core.ml.action.GetDataFrameAnalyticsStatsAction;
import org.elasticsearch.xpack.core.ml.action.StartDataFrameAnalyticsAction;
import org.elasticsearch.xpack.core.ml.action.StopDataFrameAnalyticsAction;
import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsState;
import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsTaskState;
import org.elasticsearch.xpack.core.ml.job.messages.Messages;
@ -107,7 +108,7 @@ public class DataFrameAnalyticsTask extends AllocatedPersistentTask implements S
@Override
protected void onCancelled() {
stop(getReasonCancelled(), TimeValue.ZERO);
stop(getReasonCancelled(), StopDataFrameAnalyticsAction.DEFAULT_TIMEOUT);
markAsCompleted();
}