1996fanrui commented on code in PR #710: URL: https://github.com/apache/flink-kubernetes-operator/pull/710#discussion_r1391256838
########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/autoscaler/ConfigMapStore.java: ########## @@ -67,19 +67,14 @@ protected Optional<String> getSerializedState( } protected void removeSerializedState(KubernetesJobAutoScalerContext jobContext, String key) { - getConfigMap(jobContext) - .ifPresentOrElse( - configMap -> configMap.getData().remove(key), - () -> { - throw new IllegalStateException( - "The configMap isn't created, so the remove is unavailable."); - }); + getConfigMap(jobContext).ifPresent(configMap -> configMap.getData().remove(key)); } public void flush(KubernetesJobAutoScalerContext jobContext) { Optional<ConfigMap> configMapOpt = cache.get(jobContext.getJobKey()); if (configMapOpt == null || configMapOpt.isEmpty()) { LOG.debug("The configMap isn't updated, so skip the flush."); + // Do not flush if there are no updates. Review Comment: We may need to added a extra cache to store the state that last updated. When the flush is called, then compare them. And call kubernetes if they are not same. And it's better to add a test to check the flush doesn't call kubernetes if state isn't updated. -- 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. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org