Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Check if Handler module exists before we try to call update
  • Loading branch information
iilyak committed Sep 28, 2015
1 parent aa72f6f commit 5f3fe7a16382d371c214b9f4376c6a1f50447f79
Showing 3 changed files with 27 additions and 3 deletions.
@@ -110,7 +110,15 @@ code_change(_OldVsn, State, _Extra) ->
%% Internal Function Definitions
%% ------------------------------------------------------------------

reload_if_updated(#state{hash = OldHash, module = Module} = State) ->
reload_if_updated(#state{handle = Module} = State) ->
case couch_epi_util:module_exists(Module) of
true ->
do_reload_if_updated(State);
false ->
{ok, State}
end.

do_reload_if_updated(#state{hash = OldHash, module = Module} = State) ->
case couch_epi_functions_gen:hash([Module]) of
OldHash ->
{ok, State};
@@ -144,7 +144,15 @@ ensure_exists(FilePath) ->
{error, {notfound, FilePath}}
end.

reload_if_updated(#state{hash = OldHash, locator = Locator} = State) ->
reload_if_updated(#state{handle = Module} = State) ->
case couch_epi_util:module_exists(Module) of
true ->
do_reload_if_updated(State);
false ->
{ok, State}
end.

do_reload_if_updated(#state{hash = OldHash, locator = Locator} = State) ->
case read(Locator) of
{ok, OldHash, _Data} ->
{ok, State};
@@ -112,7 +112,15 @@ code_change(_OldVsn, State, _Extra) ->
%% Internal Function Definitions
%% ------------------------------------------------------------------

reload_if_updated(#state{hash = OldHash, modules = Modules} = State) ->
reload_if_updated(#state{handle = Module} = State) ->
case couch_epi_util:module_exists(Module) of
true ->
do_reload_if_updated(State);
false ->
{ok, State}
end.

do_reload_if_updated(#state{hash = OldHash, modules = Modules} = State) ->
case couch_epi_functions_gen:hash(Modules) of
OldHash ->
{ok, State};

0 comments on commit 5f3fe7a

Please sign in to comment.