Throw 403 instead of 429 when max job capacity full (elastic/elasticsearch#445)

Closes elastic/elasticsearch#444

Original commit: elastic/x-pack-elasticsearch@dfaf8dbec4
This commit is contained in:
Zachary Tong 2016-12-02 08:26:19 -05:00 committed by GitHub
parent 41bd367071
commit b6bdef474d
2 changed files with 2 additions and 2 deletions

View File

@ -123,7 +123,7 @@ public class AutodetectProcessManager extends AbstractComponent implements DataP
AutodetectCommunicator create(String jobId, boolean ignoreDowntime) {
if (autoDetectCommunicatorByJob.size() == maxRunningJobs) {
throw new ElasticsearchStatusException("max running job capacity [" + maxRunningJobs + "] reached",
RestStatus.TOO_MANY_REQUESTS);
RestStatus.FORBIDDEN);
}
// TODO norelease, once we remove black hole process

View File

@ -81,7 +81,7 @@ public class TooManyJobsIT extends ESIntegTestCase {
logger.warn("Unexpected cause", e);
}
assertEquals(ElasticsearchStatusException.class, cause.getClass());
assertEquals(RestStatus.TOO_MANY_REQUESTS, ((ElasticsearchStatusException) cause).status());
assertEquals(RestStatus.FORBIDDEN, ((ElasticsearchStatusException) cause).status());
logger.info("good news everybody --> reached threadpool capacity after starting {}th analytical process", i);
// now manually clean things up and see if we can succeed to start one new job