File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
core/src/main/java/org/elasticsearch/transport Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -230,15 +230,19 @@ public String executor() {
230230 }
231231 });
232232 };
233- if (connectedNodes .size () == 0 ) {
234- // 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
235- // this will cause some back pressure on the search end and eventually will cause rejections but that's fine
236- // we can't proceed with a search on a cluster level.
237- // in the future we might want to just skip the remote nodes in such a case but that can already be implemented on the
238- // caller end since they provide the listener.
239- ensureConnected (ActionListener .wrap ((x ) -> runnable .run (), listener ::onFailure ));
240- } else {
241- runnable .run ();
233+ try {
234+ if (connectedNodes .size () == 0 ) {
235+ // 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
236+ // this will cause some back pressure on the search end and eventually will cause rejections but that's fine
237+ // we can't proceed with a search on a cluster level.
238+ // in the future we might want to just skip the remote nodes in such a case but that can already be implemented on the
239+ // caller end since they provide the listener.
240+ ensureConnected (ActionListener .wrap ((x ) -> runnable .run (), listener ::onFailure ));
241+ } else {
242+ runnable .run ();
243+ }
244+ } catch (Exception ex ) {
245+ listener .onFailure (ex );
242246 }
243247 }
244248
You can’t perform that action at this time.
0 commit comments