[ML] Use the correct timeout for the process context lock (elastic/x-pack-elasticsearch#2935)
This change should have been made in elastic/x-pack-elasticsearch#2913. Now we hold the process context lock throughout the job close procedure, the timeout for trying to lock it should be the timeout used for job open/close rather than the timeout for connecting named pipes. Original commit: elastic/x-pack-elasticsearch@79672b0825
This commit is contained in:
parent
e29649a7bc
commit
142b59a4d5
|
@ -8,6 +8,7 @@ package org.elasticsearch.xpack.ml.job.process.autodetect;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.elasticsearch.ElasticsearchException;
|
import org.elasticsearch.ElasticsearchException;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
|
import org.elasticsearch.xpack.ml.MachineLearning;
|
||||||
import org.elasticsearch.xpack.ml.action.OpenJobAction.JobTask;
|
import org.elasticsearch.xpack.ml.action.OpenJobAction.JobTask;
|
||||||
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ final class ProcessContext {
|
||||||
|
|
||||||
void tryLock() {
|
void tryLock() {
|
||||||
try {
|
try {
|
||||||
if (lock.tryLock(NativeAutodetectProcessFactory.PROCESS_STARTUP_TIMEOUT.getSeconds(), TimeUnit.SECONDS) == false) {
|
if (lock.tryLock(MachineLearning.STATE_PERSIST_RESTORE_TIMEOUT.getSeconds(), TimeUnit.SECONDS) == false) {
|
||||||
LOGGER.error("Failed to acquire process lock for job [{}]", jobTask.getJobId());
|
LOGGER.error("Failed to acquire process lock for job [{}]", jobTask.getJobId());
|
||||||
throw ExceptionsHelper.serverError("Failed to acquire process lock for job [" + jobTask.getJobId() + "]");
|
throw ExceptionsHelper.serverError("Failed to acquire process lock for job [" + jobTask.getJobId() + "]");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue