SteNicholas commented on code in PR #2561:
URL: https://github.com/apache/celeborn/pull/2561#discussion_r1637847406


##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerSource.scala:
##########
@@ -107,13 +107,11 @@ class WorkerSource(conf: CelebornConf) extends 
AbstractSource(conf, MetricsSyste
     }
   }
 
-  def removeAppActiveConnection(applicationId: String): Unit = {
-    removeCounter(ACTIVE_CONNECTION_COUNT, Map(applicationLabel -> 
applicationId))
-    appActiveConnections.asScala.foreach { case (_, applicationIds) =>
-      if (applicationIds.contains(applicationId)) {
-        applicationIds.remove(applicationId)
-      }
-    }
+  def removeAppActiveConnection(applicationIds: util.Set[String]): Unit = {
+    applicationIds.asScala.foreach(applicationId =>
+      removeCounter(ACTIVE_CONNECTION_COUNT, Map(applicationLabel -> 
applicationId)))
+    appActiveConnections.values().asScala.foreach(connectionAppIds =>
+      applicationIds.asScala.foreach(applicationId => 
connectionAppIds.remove(applicationId)))

Review Comment:
   `connectionAppIds` is larger than `applicationIds` in most cases, therefore 
it should iterate `applicationIds` to remove `applicationId` from 
`connectionAppIds`.



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

Reply via email to