This is an automated email from the ASF dual-hosted git repository.
nvollmar pushed a commit to branch 1.0.x
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/1.0.x by this push:
new 4f77c8108a Avoid unnecessary shard updates while shutting down (#1342)
(#1353)
4f77c8108a is described below
commit 4f77c8108aaf548a65531d2c8807da13dbba8146
Author: Nicolas Vollmar <[email protected]>
AuthorDate: Tue Jun 4 11:31:06 2024 +0200
Avoid unnecessary shard updates while shutting down (#1342) (#1353)
* Avoid unnecessary shard updates while shutting down
* Avoid re-creating the same message for each shard
---
.../scala/org/apache/pekko/cluster/sharding/ShardRegion.scala | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardRegion.scala
b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardRegion.scala
index 18b002c476..6aa943e0b8 100644
---
a/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardRegion.scala
+++
b/cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardRegion.scala
@@ -1003,8 +1003,9 @@ private[pekko] class ShardRegion(
shardsByRef = shardsByRef - ref
shards = shards - shardId
startingShards -= shardId
- if (settings.passivationStrategy !=
ClusterShardingSettings.NoPassivationStrategy) {
- shards.values.foreach(_ ! ShardsUpdated(shards.size))
+ if (settings.passivationStrategy !=
ClusterShardingSettings.NoPassivationStrategy && !gracefulShutdownInProgress) {
+ val update = ShardsUpdated(shards.size)
+ shards.values.foreach(_ ! update)
}
if (handingOff.contains(ref)) {
handingOff = handingOff - ref
@@ -1348,7 +1349,8 @@ private[pekko] class ShardRegion(
shards = shards.updated(id, shard)
startingShards += id
if (settings.passivationStrategy !=
ClusterShardingSettings.NoPassivationStrategy) {
- shards.values.foreach(_ ! ShardsUpdated(shards.size))
+ val update = ShardsUpdated(shards.size)
+ shards.values.foreach(_ ! update)
}
None
case Some(_) =>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]