pzampino commented on a change in pull request #307: KNOX-2304 - CM discovery cluster config monitor needs to be aware of … URL: https://github.com/apache/knox/pull/307#discussion_r405723167
########## File path: gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/monitor/PollingConfigurationAnalyzer.java ########## @@ -360,19 +370,43 @@ private DiscoveryApiClient getApiClient(final ServiceDiscoveryConfig discoveryCo // Record the new event query timestamp for this address/cluster setEventQueryTimestamp(address, clusterName, Instant.now()); - // Query the event log from CM for service/cluster restart events - List<ApiEvent> events = queryRestartEvents(getApiClient(configCache.getDiscoveryConfig(address, clusterName)), + // Query the event log from CM for service/cluster start events + List<ApiEvent> events = queryEvents(getApiClient(configCache.getDiscoveryConfig(address, clusterName)), clusterName, lastTimestamp); for (ApiEvent event : events) { - restartEvents.add(new RestartEvent(event)); + if(isRelevantEvent(event)) { + relevantEvents.add(new StartEvent(event)); + } + } + + return relevantEvents; + } + + @SuppressWarnings("unchecked") + private boolean isRelevantEvent(ApiEvent event) { + boolean rc = false; + String command = null; + String status = null; + List<ApiEventAttribute> attributes = event.getAttributes(); + Map<String,Object> map = getAttributeMap(attributes); + command = (String) ((List<String>) map.get(COMMAND)).get(0); + status = (String) ((List<String>) map.get(COMMAND_STATUS)).get(0); + if (START_COMMAND.equals(command) || RESTART_COMMAND.equals(command) && + SUCCEEDED_STATUS.equals(status) || STARTED_STATUS.equals(status)) { Review comment: IIRC, && does have a higher precedence than ||, which could mean the default grouping is `START_COMMAND.equals(command) || (RESTART_COMMAND.equals(command) && SUCCEEDED_STATUS.equals(status)) || STARTED_STATUS.equals(status)`, which probably still works in this case ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services