Skip to content

Commit

Permalink
Catch exception during indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveCTurner committed Aug 26, 2020
1 parent 2003ec0 commit 62fe090
Showing 1 changed file with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -316,28 +316,27 @@ public void onResponse(String s) {
try (XContentBuilder builder = jsonBuilder()) {
request.source(cachedBlob.toXContent(builder, ToXContent.EMPTY_PARAMS));
}
} catch (IOException e) {

client.index(request, new ActionListener<>() {
@Override
public void onResponse(IndexResponse indexResponse) {
logger.trace("cache fill ({}): [{}]", indexResponse.status(), request.id());
listener.onResponse(null);
}

@Override
public void onFailure(Exception e) {
logger.debug(new ParameterizedMessage("failure in cache fill: [{}]", request.id()), e);
listener.onFailure(e);
}
});
} catch (Exception e) {
logger.warn(
new ParameterizedMessage("cache fill failure: [{}]", CachedBlob.generateId(repository, name, path, offset)),
e
);
listener.onFailure(e);
return;
}

client.index(request, new ActionListener<>() {
@Override
public void onResponse(IndexResponse indexResponse) {
logger.trace("cache fill ({}): [{}]", indexResponse.status(), request.id());
listener.onResponse(null);
}

@Override
public void onFailure(Exception e) {
logger.debug(new ParameterizedMessage("failure in cache fill: [{}]", request.id()), e);
listener.onFailure(e);
}
});
}

@Override

0 comments on commit 62fe090

Please sign in to comment.