Skip to content

Commit 77b0d33

Browse files
Fix Force Merge Action Invoking a Listener Twice (#75897) (#76529)
Just a noisy thing, this isn't causing a bug since the listener is of the notify-once kind here but still.
1 parent 54ba170 commit 77b0d33

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server/src/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ protected ForceMergeRequest readRequestFrom(StreamInput in) throws IOException {
7070
@Override
7171
protected void shardOperation(ForceMergeRequest request, ShardRouting shardRouting, Task task,
7272
ActionListener<TransportBroadcastByNodeAction.EmptyResult> listener) {
73-
threadPool.executor(ThreadPool.Names.FORCE_MERGE).execute(ActionRunnable.run(listener,
73+
assert (task instanceof CancellableTask) == false; // TODO: add cancellation handling here once the task supports it
74+
threadPool.executor(ThreadPool.Names.FORCE_MERGE).execute(ActionRunnable.supply(listener,
7475
() -> {
75-
assert (task instanceof CancellableTask) == false; // TODO: add cancellation handling here once the task supports it
7676
IndexShard indexShard = indicesService.indexServiceSafe(shardRouting.shardId().getIndex())
7777
.getShard(shardRouting.shardId().id());
7878
indexShard.forceMerge(request);
79-
listener.onResponse(EmptyResult.INSTANCE);
79+
return EmptyResult.INSTANCE;
8080
}));
8181
}
8282

0 commit comments

Comments
 (0)