Skip to content

Commit

Permalink
ActionListener.run
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrx committed Jun 23, 2023
1 parent eda0ada commit 50940c2
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3747,7 +3747,7 @@ ReplicationTracker getReplicationTracker() {
* Executes a scheduled refresh if necessary. Completes the listener with true if a refreshed was performed otherwise false.
*/
public void scheduledRefresh(ActionListener<Boolean> listener) {
try {
ActionListener.run(listener, l -> {
verifyNotClosed();
boolean listenerNeedsRefresh = refreshListeners.refreshNeeded();
final Engine engine = getEngine();
Expand All @@ -3762,19 +3762,17 @@ && isSearchIdle()
// cause the next schedule to refresh.
engine.maybePruneDeletes(); // try to prune the deletes in the engine if we accumulated some
setRefreshPending(engine);
listener.onResponse(false);
l.onResponse(false);
return;
} else {
logger.trace("refresh with source [schedule]");
engine.maybeRefresh("schedule", listener.map(Engine.RefreshResult::refreshed));
engine.maybeRefresh("schedule", l.map(Engine.RefreshResult::refreshed));
return;
}
}
engine.maybePruneDeletes(); // try to prune the deletes in the engine if we accumulated some
listener.onResponse(false);
} catch (Exception e) {
listener.onFailure(e);
}
l.onResponse(false);
});
}

/**
Expand Down

0 comments on commit 50940c2

Please sign in to comment.