couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [1/7] couchdb-couch-epi git commit: Check if Handler module exists before we try to call update
Date Thu, 01 Oct 2015 15:03:50 GMT
Repository: couchdb-couch-epi
Updated Branches:
  refs/heads/master aa72f6ffc -> be34447c5


Check if Handler module exists before we try to call update


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/commit/5f3fe7a1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/tree/5f3fe7a1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/diff/5f3fe7a1

Branch: refs/heads/master
Commit: 5f3fe7a16382d371c214b9f4376c6a1f50447f79
Parents: aa72f6f
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Mon Sep 21 12:21:16 2015 -0700
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Mon Sep 28 09:25:55 2015 -0700

----------------------------------------------------------------------
 src/couch_epi_data.erl        | 10 +++++++++-
 src/couch_epi_data_source.erl | 10 +++++++++-
 src/couch_epi_functions.erl   | 10 +++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/blob/5f3fe7a1/src/couch_epi_data.erl
----------------------------------------------------------------------
diff --git a/src/couch_epi_data.erl b/src/couch_epi_data.erl
index b685dae..502ed69 100644
--- a/src/couch_epi_data.erl
+++ b/src/couch_epi_data.erl
@@ -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};

http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/blob/5f3fe7a1/src/couch_epi_data_source.erl
----------------------------------------------------------------------
diff --git a/src/couch_epi_data_source.erl b/src/couch_epi_data_source.erl
index f905e8f..ef83b14 100644
--- a/src/couch_epi_data_source.erl
+++ b/src/couch_epi_data_source.erl
@@ -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};

http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/blob/5f3fe7a1/src/couch_epi_functions.erl
----------------------------------------------------------------------
diff --git a/src/couch_epi_functions.erl b/src/couch_epi_functions.erl
index 09ece2e..33c4f91 100644
--- a/src/couch_epi_functions.erl
+++ b/src/couch_epi_functions.erl
@@ -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};


Mime
View raw message