Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initialize cmd persist failure #1453

Merged
merged 3 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,17 @@ class ProcessIndex(recipeInstanceIdleTimeout: Option[FiniteDuration],
case _ if index(recipeInstanceId).isDeleted =>
sender() ! ProcessDeleted(recipeInstanceId)
case None =>
//TODO decide what to do in this situation.
log.error("ProcessInstance not found but it is found in the index")
sender() ! ProcessAlreadyExists(recipeInstanceId)
//Temporary solution for the situation that the initializeCmd is not send in the original Bake
getCompiledRecipe(recipeId) match {
case Some(compiledRecipe) =>
val processState = RecipeInstanceState(recipeInstanceId, Map.empty[String, Value], List.empty)
val initializeCmd = Initialize(compiledRecipe.initialMarking, processState)
createProcessActor(recipeInstanceId, compiledRecipe) ! initializeCmd
sender() ! ProcessAlreadyExists(recipeInstanceId)
case None =>
//Kept the ProcessAlreadyExists since this was the original error
sender() ! ProcessAlreadyExists(recipeInstanceId)
}
case Some(actorRef: ActorRef) =>
//Temporary solution for the situation that the initializeCmd is not send in the original Bake
getCompiledRecipe(recipeId) match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class ProcessIndexSpec extends TestKit(ActorSystem("ProcessIndexSpec", ProcessIn
actorIndex ! CreateProcess(recipeId, recipeInstanceId)
petriNetActorProbe.expectMsg(initializeMsg)
actorIndex ! CreateProcess(recipeId, recipeInstanceId)
petriNetActorProbe.expectNoMessage(noMsgExpectTimeout)
petriNetActorProbe.expectMsg(initializeMsg)
expectMsg(ProcessAlreadyExists(recipeInstanceId))
}

Expand Down