From 274f215aa4fd6d407e2fbd9af9ce9a94dad9bd23 Mon Sep 17 00:00:00 2001 From: Kaituo Li Date: Wed, 19 Feb 2020 20:37:53 -0800 Subject: [PATCH] Send back error response when failing to stop detector Previously, a stop detector api request hangs until timeout if there is a failure. Testing done: * verified the issue is fixed --- .../ad/rest/RestDeleteAnomalyDetectorAction.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestDeleteAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestDeleteAnomalyDetectorAction.java index c6a08a06..cbe14149 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestDeleteAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestDeleteAnomalyDetectorAction.java @@ -133,6 +133,7 @@ public void onResponse(StopDetectorResponse stopDetectorResponse) { @Override public void onFailure(Exception e) { logger.error("Failed to delete AD model for detector " + detectorId, e); + channel.sendResponse(new BytesRestResponse(RestStatus.INTERNAL_SERVER_ERROR, "Failed to delete AD model")); } }; }