fix: proper path when promise actor terminated quickly (#1156)
This commit is contained in:
parent
d884540c92
commit
2fdf7c9e9b
2 changed files with 24 additions and 1 deletions
|
|
@ -266,6 +266,29 @@ class AskSpec extends PekkoSpec("""
|
|||
val (promiseActorRefForSelection, "ask") = p.expectMsgType[(ActorRef, String)]: @unchecked
|
||||
promiseActorRefForSelection.path.name should startWith("_user_myName")
|
||||
}
|
||||
|
||||
"proper path when promise actor terminated" in {
|
||||
implicit val timeout: Timeout = Timeout(300 millis)
|
||||
val p = TestProbe()
|
||||
|
||||
val act = system.actorOf(Props(new Actor {
|
||||
def receive = {
|
||||
case _ =>
|
||||
val senderRef: ActorRef = sender()
|
||||
senderRef ! "complete"
|
||||
p.ref ! senderRef
|
||||
}
|
||||
}), "pathPrefix")
|
||||
|
||||
val f = (act ? "ask").mapTo[String]
|
||||
val promiseActorRef = p.expectMsgType[ActorRef]: @unchecked
|
||||
|
||||
// verify ask complete
|
||||
val completed = f.futureValue
|
||||
completed should ===("complete")
|
||||
// verify path was proper
|
||||
promiseActorRef.path.toString should include("pathPrefix")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ private[pekko] final class PromiseActorRef(
|
|||
case StoppedWithPath(p) => p
|
||||
case Stopped =>
|
||||
// even if we are already stopped we still need to produce a proper path
|
||||
updateState(Stopped, StoppedWithPath(provider.tempPath()))
|
||||
updateState(Stopped, StoppedWithPath(provider.tempPath(refPathPrefix)))
|
||||
path
|
||||
case Registering => path // spin until registration is completed
|
||||
case unexpected => throw new IllegalStateException(s"Unexpected state: $unexpected")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue