He-Pin commented on code in PR #1304:
URL: https://github.com/apache/pekko/pull/1304#discussion_r1585013146
##########
cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ClusterSharding.scala:
##########
@@ -425,15 +425,19 @@ class ClusterSharding(system: ExtendedActorSystem)
extends Extension {
allocationStrategy: ShardAllocationStrategy,
handOffStopMessage: Any): ActorRef = {
+ val extractEntityId: ShardRegion.ExtractEntityId = { msg =>
+ messageExtractor.entityId(msg) match {
+ case eid => (eid, messageExtractor.entityMessage(msg))
Review Comment:
So does here
##########
cluster-sharding-typed/src/main/scala/org/apache/pekko/cluster/sharding/typed/internal/ClusterShardingImpl.scala:
##########
@@ -173,10 +173,10 @@ import pekko.util.JavaDurationConverters._
allocationStrategy: Option[ShardAllocationStrategy]): ActorRef[E] = {
val extractorAdapter = new ExtractorAdapter(extractor)
- val extractEntityId: ShardRegion.ExtractEntityId = {
- // TODO is it possible to avoid the double evaluation of entityId
- case message if extractorAdapter.entityId(message) != null =>
- (extractorAdapter.entityId(message),
extractorAdapter.unwrapMessage(message))
+ val extractEntityId: ShardRegion.ExtractEntityId = { message =>
+ extractorAdapter.entityId(message) match {
+ case eid => (eid, extractorAdapter.unwrapMessage(message))
Review Comment:
Not sure if we still need a match for this
--
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]