Skip to content

Commit 1d91e12

Browse files
fix delete model API (#748) (#749)
Signed-off-by: Bhavana Ramaram <[email protected]> (cherry picked from commit a61821d) Co-authored-by: Bhavana Ramaram <[email protected]>
1 parent 10f1f07 commit 1d91e12

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected void doExecute(Task task, ActionRequest request, ActionListener<Delete
7878
GetRequest getRequest = new GetRequest(ML_MODEL_INDEX).id(modelId).fetchSourceContext(fetchSourceContext);
7979

8080
try (ThreadContext.StoredContext context = client.threadPool().getThreadContext().stashContext()) {
81-
client.get(getRequest, ActionListener.runBefore(ActionListener.wrap(r -> {
81+
client.get(getRequest, ActionListener.wrap(r -> {
8282
if (r != null && r.isExists()) {
8383
try (XContentParser parser = createXContentParserFromRegistry(xContentRegistry, r.getSourceAsBytesRef())) {
8484
ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser);
@@ -114,7 +114,7 @@ public void onFailure(Exception e) {
114114
actionListener.onFailure(e);
115115
}
116116
}
117-
}, e -> { actionListener.onFailure(new MLResourceNotFoundException("Fail to find model")); }), () -> context.restore()));
117+
}, e -> { actionListener.onFailure(new MLResourceNotFoundException("Fail to find model")); }));
118118
} catch (Exception e) {
119119
log.error("Failed to delete ML model " + modelId, e);
120120
actionListener.onFailure(e);

0 commit comments

Comments
 (0)