We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f1eb4a commit 2a5d6c5Copy full SHA for 2a5d6c5
entities/src/main/scala/com/devsisters/shardcake/Sharding.scala
@@ -214,8 +214,12 @@ class Sharding private (
214
})
215
216
private[shardcake] def initReply(id: String, replyChannel: ReplyChannel[Nothing]): UIO[Unit] =
217
- replyChannels.update(_.updated(id, replyChannel)) <*
218
- replyChannel.await.ensuring(replyChannels.update(_ - id)).forkDaemon
+ replyChannels
+ .getAndUpdate(_.updated(id, replyChannel))
219
+ .flatMap(beforeReplyChannels =>
220
+ replyChannel.await.ensuring(replyChannels.update(_ - id)).forkDaemon.unless(beforeReplyChannels.contains(id))
221
+ )
222
+ .unit
223
224
def reply[Reply](reply: Reply, replier: Replier[Reply]): UIO[Unit] =
225
replyChannels
0 commit comments