Merge pull request #26142 from nvollmar/wip-26141-fix-backoff-supervisor
Fixes final stop message handling #26141
This commit is contained in:
commit
6d6ac21f30
2 changed files with 21 additions and 2 deletions
|
|
@ -350,7 +350,25 @@ class BackoffSupervisorSpec extends AkkaSpec with ImplicitSender with Eventually
|
|||
c1 ! PoisonPill
|
||||
expectTerminated(c1)
|
||||
expectTerminated(supervisor)
|
||||
}
|
||||
|
||||
"supervisor must not stop when final stop message has not been received" in {
|
||||
val stopMessage = "stop"
|
||||
val supervisorWatcher = TestProbe()
|
||||
val supervisor: ActorRef = create(onStopOptions(maxNrOfRetries = 100).withFinalStopMessage(_ == stopMessage))
|
||||
supervisor ! BackoffSupervisor.GetCurrentChild
|
||||
val c1 = expectMsgType[BackoffSupervisor.CurrentChild].ref.get
|
||||
watch(c1)
|
||||
watch(supervisor)
|
||||
supervisorWatcher.watch(supervisor)
|
||||
|
||||
c1 ! PoisonPill
|
||||
expectTerminated(c1)
|
||||
supervisor ! "ping"
|
||||
supervisorWatcher.expectNoMessage(20.millis) // supervisor must not terminate
|
||||
|
||||
supervisor ! stopMessage
|
||||
expectTerminated(supervisor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -436,8 +436,9 @@ private[akka] trait HandleBackoff { this: Actor ⇒
|
|||
finalStopMessage match {
|
||||
case None ⇒
|
||||
case Some(fsm) ⇒
|
||||
fsm(msg)
|
||||
context.stop(self)
|
||||
if (fsm(msg)) {
|
||||
context.stop(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue