Consolidated passivation check on settings used in region and shard (#27738)

This commit is contained in:
Helena Edelson 2019-09-19 04:23:27 -07:00 committed by Patrik Nordwall
parent a84aa0095c
commit ef09dca732
5 changed files with 63 additions and 11 deletions

View file

@ -311,6 +311,11 @@ final class ClusterShardingSettings(
private[akka] def shouldHostShard(cluster: Cluster): Boolean =
role.forall(cluster.selfMember.roles.contains)
/** If true, idle entities should be passivated if they have not received any message by this interval, otherwise it is not enabled. */
@InternalApi
private[akka] val shouldPassivateIdleEntities: Boolean =
passivateIdleEntityAfter > Duration.Zero && !rememberEntities
def withRole(role: String): ClusterShardingSettings = copy(role = ClusterShardingSettings.roleOption(role))
def withRole(role: Option[String]): ClusterShardingSettings = copy(role = role)