MSPF-91: fixed startup termination due to failed healthcheck (#12)

This commit is contained in:
Evgeny Levenets 2016-10-17 18:35:19 +03:00 committed by GitHub
parent 7427f8d44e
commit db64a67215
2 changed files with 8 additions and 4 deletions

View File

@ -116,9 +116,7 @@ apply_commit(VersionWas, #'Commit'{ops = Ops}, History) ->
-spec start(application:start_type(), term()) -> {ok, pid()} | {error, term()}.
start(_StartType, _Args) ->
{ok, Pid} = supervisor:start_link({local, ?MODULE}, ?MODULE, []),
{ok, _Context} = dmt_api_mg:start(dmt_api_context:new()),
{ok, Pid}.
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
-spec stop(term()) -> ok.

View File

@ -72,7 +72,13 @@ commit(Version, Commit, Context) ->
call(Method, Args, Context) ->
Request = {{dmsl_state_processing_thrift, 'Automaton'}, Method, [?NS | Args]},
{ok, URL} = application:get_env(dmt_api, automaton_service_url),
woody_client:call(Context, Request, #{url => URL}).
try
woody_client:call(Context, Request, #{url => URL})
catch
throw:{{exception, #'MachineNotFound'{}}, Context1} ->
{ok, Context2} = start(Context1),
woody_client:call(Context2, Request, #{url => URL})
end.
%% utils