Pass working candidate state rather than published state to timer code
Avoids triggering pointless cluster state recomputation edges because
the timer code observes stale information. This can happen if publishing
the candidate state is suppressed due to e.g. the minimum time between
published state versions not having passed.
@@ -812,8 +812,9 @@ public class FleetController implements NodeStateOrHostInfoChangeHandler, NodeAd
// Send getNodeState requests to zero or more nodes.
didWork |= stateGatherer.sendMessages(cluster, communicator, this);
- // Important: timer events must use a consolidated state, or they might trigger edge events multiple times.
- didWork |= stateChangeHandler.watchTimers(cluster, consolidatedClusterState(), this);
+ // Important: timer events must use a state with pending changes visible, or they might
+ // trigger edge events multiple times.
+ didWork |= stateChangeHandler.watchTimers(cluster, stateVersionTracker.getLatestCandidateState().getClusterState(), this);
didWork |= recomputeClusterStateIfRequired();
