File tree Expand file tree Collapse file tree 1 file changed +8
-16
lines changed
Expand file tree Collapse file tree 1 file changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -110,22 +110,14 @@ defmodule ExHealth do
110110
111111 quote do
112112 def unquote ( function_name ) ( ) do
113- case Process . whereis ( unquote ( module ) ) do
114- nil ->
115- { :error , "no proc" }
116-
117- pid ->
118- case Process . info ( pid ) do
119- nil ->
120- { :error , "no proc" }
121-
122- info ->
123- case Keyword . fetch ( info , :status ) do
124- { :ok , :running } -> :ok
125- { :ok , :waiting } -> :ok
126- _ -> { :error , "process not running/waiting" }
127- end
128- end
113+ with pid <- Process . whereis ( unquote ( module ) ) ,
114+ info <- Process . info ( pid ) ,
115+ { :ok , status } <- Keyword . fetch ( info , :status ) ,
116+ status == :running || :waiting do
117+ :ok
118+ else
119+ nil -> { :error , "no proc" }
120+ _ -> { :error , "process not running/waiting" }
129121 end
130122 end
131123 end
You can’t perform that action at this time.
0 commit comments