Skip to content

Commit 7ced454

Browse files
committed
TIKA-4809: Map CLIENT_UNAVAILABLE_WITHIN_MS to 429 instead of 503
1 parent 1a6aeac commit 7ced454

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/PipesParsingHelper.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,14 @@ public static Response.Status mapStatusToHttpResponse(PipesResult.RESULT_STATUS
282282
EMIT_SUCCESS, EMIT_SUCCESS_PARSE_EXCEPTION, EMIT_SUCCESS_PASSBACK,
283283
PARSE_EXCEPTION_NO_EMIT ->
284284
Response.Status.OK;
285-
case TIMEOUT, OOM, UNSPECIFIED_CRASH, CLIENT_UNAVAILABLE_WITHIN_MS ->
285+
case TIMEOUT, OOM, UNSPECIFIED_CRASH ->
286286
Response.Status.SERVICE_UNAVAILABLE;
287+
// Distinct from the crash statuses above: nothing failed here, the client
288+
// pool was simply at capacity for longer than maxWaitForClientMillis. 429
289+
// lets monitoring/alerting on HTTP status alone tell "we're at capacity"
290+
// (scale up numClients) apart from "a worker is actually crashing" (503).
291+
case CLIENT_UNAVAILABLE_WITHIN_MS ->
292+
Response.Status.TOO_MANY_REQUESTS;
287293
case FETCH_EXCEPTION, EMIT_EXCEPTION,
288294
FETCHER_NOT_FOUND, EMITTER_NOT_FOUND,
289295
PAYLOAD_LIMIT_EXCEEDED,

0 commit comments

Comments
 (0)