Skip to content

Commit 54617cb

Browse files
authored
[ML] Remove the cluster state listener when the adaptive allocations service stops (#113524) (#113530)
1 parent 40f1e50 commit 54617cb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/adaptiveallocations/AdaptiveAllocationsScalerService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,17 @@ public synchronized void start() {
259259
}
260260

261261
public synchronized void stop() {
262+
clusterService.removeListener(this);
262263
stopScheduling();
263264
metrics.close();
264265
}
265266

266267
@Override
267268
public void clusterChanged(ClusterChangedEvent event) {
269+
if (event.metadataChanged() == false) {
270+
return;
271+
}
272+
268273
updateAutoscalers(event.state());
269274
if (scalers.isEmpty() == false) {
270275
startScheduling();

0 commit comments

Comments
 (0)