You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2026/07/30 00:29:26 UTC

[PR] improve discovery-aws-api [pekko-management]

pjfanning opened a new pull request, #907:
URL: https://github.com/apache/pekko-management/pull/907

   L12 — Eager client initialization: Changed ec2Client from val to lazy val (line 103 in Ec2TagBasedServiceDiscovery.scala). The ECS client was already lazy val.
   
   L13 — Unnecessary .toList materializations:
   - EC2 getInstances: Removed .toList from both .asScala.toList calls (lines 147–148), letting flatMap and map operate on the lazy Buffer from .asScala, with a single .toList at the end.
   - ECS describeTasks: Changed .grouped(100).toList to .grouped(100).toSeq (line 147), avoiding materializing the grouped iterator into a List of Seqs.
   
   L14 — Clients never closed: Added CoordinatedShutdown tasks in PhaseServiceUnbind that call shutdown() on both the EC2 and ECS clients (ec2Client.shutdown(), ecsClient.shutdown()).


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] improve discovery-aws-api [pekko-management]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #907:
URL: https://github.com/apache/pekko-management/pull/907#discussion_r3717622898


##########
discovery-aws-api/src/main/scala/org/apache/pekko/discovery/awsapi/ec2/Ec2TagBasedServiceDiscovery.scala:
##########
@@ -19,7 +19,7 @@ import com.amazonaws.retry.PredefinedRetryPolicies
 import com.amazonaws.services.ec2.model.{ DescribeInstancesRequest, Filter, Reservation }
 import com.amazonaws.services.ec2.{ AmazonEC2, AmazonEC2ClientBuilder }
 import org.apache.pekko
-import pekko.actor.ExtendedActorSystem
+import pekko.actor.{ CoordinatedShutdown, ExtendedActorSystem }
 import pekko.annotation.InternalApi
 import pekko.discovery.ServiceDiscovery.{ Resolved, ResolvedTarget }

Review Comment:
   One thing to consider: since ec2Client is now lazy, this shutdown task will force-initialize the client during CoordinatedShutdown even if discovery was never used — which means AWS credential resolution happens at shutdown time purely to shut the client down again, and that could block or fail in some environments. The same applies to the ECS side. Maybe only shut the client down if it was actually created (e.g. track creation with a flag or hold it in an AtomicReference)? Not a blocker, but could be surprising in practice.



-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] improve discovery-aws-api [pekko-management]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #907:
URL: https://github.com/apache/pekko-management/pull/907#discussion_r3743200041


##########
discovery-aws-api/src/main/scala/org/apache/pekko/discovery/awsapi/ec2/Ec2TagBasedServiceDiscovery.scala:
##########
@@ -19,7 +19,7 @@ import com.amazonaws.retry.PredefinedRetryPolicies
 import com.amazonaws.services.ec2.model.{ DescribeInstancesRequest, Filter, Reservation }
 import com.amazonaws.services.ec2.{ AmazonEC2, AmazonEC2ClientBuilder }
 import org.apache.pekko
-import pekko.actor.ExtendedActorSystem
+import pekko.actor.{ CoordinatedShutdown, ExtendedActorSystem }
 import pekko.annotation.InternalApi
 import pekko.discovery.ServiceDiscovery.{ Resolved, ResolvedTarget }

Review Comment:
   change made to avoid this issue



-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] improve discovery-aws-api [pekko-management]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #907:
URL: https://github.com/apache/pekko-management/pull/907


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org