Skip to content

Commit

Permalink
Catch exceptions and inform handler in RemoteClusterConnection#collec…
Browse files Browse the repository at this point in the history
…tNodes (#26725)

This adds a missing catch block to invoke the action listener instead of bubbeling
up the exception.

Closes #26700
  • Loading branch information
s1monw committed Sep 20, 2017
1 parent 5991192 commit 81cb456
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,19 @@ public String executor() {
}
});
};
if (connectedNodes.size() == 0) {
// just in case if we are not connected for some reason we try to connect and if we fail we have to notify the listener
// this will cause some back pressure on the search end and eventually will cause rejections but that's fine
// we can't proceed with a search on a cluster level.
// in the future we might want to just skip the remote nodes in such a case but that can already be implemented on the
// caller end since they provide the listener.
ensureConnected(ActionListener.wrap((x) -> runnable.run(), listener::onFailure));
} else {
runnable.run();
try {
if (connectedNodes.size() == 0) {
// just in case if we are not connected for some reason we try to connect and if we fail we have to notify the listener
// this will cause some back pressure on the search end and eventually will cause rejections but that's fine
// we can't proceed with a search on a cluster level.
// in the future we might want to just skip the remote nodes in such a case but that can already be implemented on the
// caller end since they provide the listener.
ensureConnected(ActionListener.wrap((x) -> runnable.run(), listener::onFailure));
} else {
runnable.run();
}
} catch (Exception ex) {
listener.onFailure(ex);
}
}

Expand Down

0 comments on commit 81cb456

Please sign in to comment.