Deliver buffered messages after passivation, #26957

* This problem was introduced in the optimization in PR #26878,
  and that regression has not been released.
* While waiting for the ddata update response it buffers messages
  for the entity that is stopped/started and in the case of passivation
  those buffered messages were not delivered afterwards. Therefore
  the test failed when waiting for the expected response.
This commit is contained in:
Patrik Nordwall 2019-05-20 08:37:55 +02:00
parent a2658cc8a0
commit 1ef65091f6
3 changed files with 27 additions and 6 deletions

View file

@ -430,9 +430,18 @@ private[akka] class Shard(
// EntityStopped handler
def passivateCompleted(event: EntityStopped): Unit = {
log.debug("Entity stopped after passivation [{}]", event.entityId)
val hasBufferedMessages = messageBuffers.getOrEmpty(event.entityId).nonEmpty
state = state.copy(state.entities - event.entityId)
messageBuffers.remove(event.entityId)
if (hasBufferedMessages) {
log.debug(
"Entity stopped after passivation [{}], but will be started again due to buffered messages.",
event.entityId)
processChange(EntityStarted(event.entityId))(sendMsgBuffer)
} else {
log.debug("Entity stopped after passivation [{}]", event.entityId)
messageBuffers.remove(event.entityId)
}
}
// EntityStarted handler