@@ -101,16 +101,15 @@ defmodule Reactor.Process.Step.StartChild do
101101 @ impl true
102102 def undo ( pid , arguments , context , options ) do
103103 with { :ok , arguments } <- Spark.Options . validate ( Enum . to_list ( arguments ) , @ arg_schema ) ,
104- { :ok , options } <- Spark.Options . validate ( options , @ opt_schema ) do
105- if Keyword . get ( options , :terminate_on_undo? , true ) do
106- with { :ok , % { id: id } } <- child_spec ( arguments [ :child_spec ] ) do
107- ref = Process . monitor ( pid )
108- options [ :module ] . terminate_child ( arguments [ :supervisor ] , id )
109- await_exit ( pid , ref , options [ :termination_timeout ] , context . current_step )
110- end
111- else
112- :ok
113- end
104+ { :ok , options } <- Spark.Options . validate ( options , @ opt_schema ) ,
105+ true <- Keyword . get ( options , :terminate_on_undo? , true ) ,
106+ { :ok , % { id: id } } <- child_spec ( arguments [ :child_spec ] ) do
107+ ref = Process . monitor ( pid )
108+ options [ :module ] . terminate_child ( arguments [ :supervisor ] , id )
109+ await_exit ( pid , ref , options [ :termination_timeout ] , context . current_step )
110+ else
111+ false -> :ok
112+ error -> error
114113 end
115114 end
116115
0 commit comments