Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,15 @@ public void testEvaluateWithMinimalTimeout() throws IOException {
putModelDefinition(modelId);
putVocabulary(List.of("these", "are", "my", "words"), modelId);
startDeployment(modelId);
ResponseException ex = expectThrows(ResponseException.class, () -> infer("my words", modelId, TimeValue.ZERO));
assertThat(ex.getResponse().getStatusLine().getStatusCode(), equalTo(429));
// There is a race between inference and timeout so that
// even with a zero timeout a valid inference response may
// be returned.
// The test asserts that if an error occurs it is a timeout error
try {
infer("my words", modelId, TimeValue.ZERO);
} catch (ResponseException ex) {
assertThat(ex.getResponse().getStatusLine().getStatusCode(), equalTo(408));
}
stopDeployment(modelId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void onTimeout() {
if (notified.compareAndSet(false, true)) {
processContext.getResultProcessor().ignoreResposeWithoutNotifying(String.valueOf(requestId));
listener.onFailure(
new ElasticsearchStatusException("timeout [{}] waiting for inference result", RestStatus.TOO_MANY_REQUESTS, timeout)
new ElasticsearchStatusException("timeout [{}] waiting for inference result", RestStatus.REQUEST_TIMEOUT, timeout)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Good change. This is left over from before we had queueing back-pressure as the signal for too many requests.

);
return;
}
Expand Down