RocMarshal commented on code in PR #865:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/865#discussion_r1719192530


##########
flink-autoscaler-plugin-jdbc/src/main/java/org/apache/flink/autoscaler/jdbc/event/JdbcAutoScalerEventHandler.java:
##########
@@ -104,6 +134,43 @@ public void handleScalingEvent(
         }
     }
 
+    @Override
+    public void close() {
+        if (Objects.nonNull(scheduledEventHandlerCleaner)
+                && !scheduledEventHandlerCleaner.isShutdown()) {
+            scheduledEventHandlerCleaner.shutdownNow();
+        }
+    }
+
+    @VisibleForTesting
+    void cleanExpiredEvents() {
+        try {
+            JdbcEventInteractor.ExpiredEventsResult expiredResult =
+                    
jdbcEventInteractor.queryExpiredEventsAndMaxId(eventHandlerTtl);
+            if (Objects.isNull(expiredResult)) {
+                log.warn("No expired event handlers queried at {}", new 
Date());
+                return;
+            }
+            var batch = 4098;
+            var startId = expiredResult.minId;
+            var endId = Math.min(startId + batch, expiredResult.maxId);
+            while (startId <= expiredResult.maxId) {
+                jdbcEventInteractor.deleteExpiredEventsByIdRange(startId, 
endId);

Review Comment:
   The `limit` is not supported in postgres delete clause.
   So, I try to use the current way



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