From 3ff4eb5a0ddeb4480abc234ec52d574c2c73b5fd Mon Sep 17 00:00:00 2001 From: Paul Shchichko Date: Sat, 20 Jul 2024 18:31:23 +0800 Subject: [PATCH] Keep assignments got from shard manager in updateAssignments --- entities/src/main/scala/com/devsisters/shardcake/Sharding.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entities/src/main/scala/com/devsisters/shardcake/Sharding.scala b/entities/src/main/scala/com/devsisters/shardcake/Sharding.scala index 4467a0c..70d2569 100644 --- a/entities/src/main/scala/com/devsisters/shardcake/Sharding.scala +++ b/entities/src/main/scala/com/devsisters/shardcake/Sharding.scala @@ -139,7 +139,7 @@ class Sharding private ( Metrics.shards .set(assignmentsOpt.count { case (_, podOpt) => podOpt.contains(address) }) .when(fromShardManager) *> - (if (fromShardManager) shardAssignments.update(map => if (map.isEmpty) assignments else map) + (if (fromShardManager) shardAssignments.set(assignments) else shardAssignments.update(map => // we keep self assignments (we don't override them with the new assignments