Copilot commented on code in PR #7220:
URL: https://github.com/apache/kyuubi/pull/7220#discussion_r2396716515


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -199,13 +199,7 @@ class KubernetesApplicationOperation extends 
ApplicationOperation with Logging {
       expireCleanUpTriggerCacheExecutor,
       () => {
         try {
-          Option(cleanupTerminatedAppInfoTrigger).foreach { trigger =>
-            trigger.asMap().asScala.foreach {
-              case (key, _) =>
-                // do get to trigger cache eviction
-                trigger.getIfPresent(key)
-            }
-          }
+          Option(cleanupTerminatedAppInfoTrigger).foreach(_.cleanUp())

Review Comment:
   The code improvement simplifies the cache cleanup logic, but consider 
verifying that `cleanUp()` provides the same cleanup behavior as the previous 
manual iteration. The manual approach specifically triggered eviction through 
`getIfPresent()`, while `cleanUp()` may use different internal logic for 
expired entry removal.
   ```suggestion
             Option(cleanupTerminatedAppInfoTrigger).foreach { cache =>
               cache.asMap().keySet().asScala.foreach(cache.getIfPresent)
             }
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to