gaborgsomogyi commented on code in PR #437:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/437#discussion_r1023637452


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java:
##########
@@ -318,6 +319,31 @@ private boolean shouldRestartJobBecauseUnhealthy(
         return restartNeeded;
     }
 
+    private boolean cleanupTerminalJmAfterTtl(
+            FlinkDeployment deployment, Configuration observeConfig) {
+        var status = deployment.getStatus();
+        boolean terminal = ReconciliationUtils.isJobInTerminalState(status);
+        boolean jmStillRunning =
+                status.getJobManagerDeploymentStatus() != 
JobManagerDeploymentStatus.MISSING;
+
+        if (terminal && jmStillRunning) {
+            var ttl = 
observeConfig.get(KubernetesOperatorConfigOptions.OPERATOR_JM_SHUTDOWN_TTL);
+            boolean ttlPassed =
+                    Instant.now()

Review Comment:
   I know that the window in the test is big enough but using `now` in tests 
may make it flaky. I would add `Clock` param either to the function or as 
member var. In tests it can be `Clock.fixed...` and in PROD code 
`Clock.systemDefaultZone()`.



-- 
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

Reply via email to