Check remembered entities before remembering entity (#25271)
* Check remembered entities before remembering entity Messages that come through for an entity before StartEntity has been processed for that entity caused redundant persistence of the entity.
This commit is contained in:
parent
51e0bc2347
commit
a05170c419
1 changed files with 8 additions and 4 deletions
|
|
@ -455,11 +455,15 @@ private[akka] trait RememberingShard { selfType: Shard ⇒
|
|||
context.child(name) match {
|
||||
case Some(actor) ⇒
|
||||
actor.tell(payload, snd)
|
||||
|
||||
case None ⇒
|
||||
//Note; we only do this if remembering, otherwise the buffer is an overhead
|
||||
messageBuffers.append(id, msg, snd)
|
||||
processChange(EntityStarted(id))(sendMsgBuffer)
|
||||
if (state.entities.contains(id)) {
|
||||
require(!messageBuffers.contains(id), s"Message buffers contains id [$id].")
|
||||
getEntity(id).tell(payload, snd)
|
||||
} else {
|
||||
//Note; we only do this if remembering, otherwise the buffer is an overhead
|
||||
messageBuffers.append(id, msg, snd)
|
||||
processChange(EntityStarted(id))(sendMsgBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue