Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClusterShardingLeaseSpec: extractShardId should include StartEntity #30632

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -9,6 +9,7 @@ import scala.util.Success
import scala.util.control.NoStackTrace
import com.typesafe.config.{ Config, ConfigFactory }
import akka.actor.Props
import akka.cluster.sharding.ShardRegion.StartEntity
import akka.cluster.{ Cluster, MemberStatus }
import akka.coordination.lease.TestLease
import akka.coordination.lease.TestLeaseExt
Expand Down Expand Up @@ -50,9 +51,12 @@ object ClusterShardingLeaseSpec {
case msg: Int => (msg.toString, msg)
}

val numOfShards = 10

val extractShardId: ShardRegion.ExtractShardId = {
case msg: Int => (msg % 10).toString
case _ => throw new IllegalArgumentException()
case msg: Int => (msg % numOfShards).toString
case msg: StartEntity => (msg.entityId.toInt % numOfShards).toString
case _ => throw new IllegalArgumentException()
}
case class LeaseFailed(msg: String) extends RuntimeException(msg) with NoStackTrace
}
Expand Down