Merge remote branch 'cloudant:3102-fixup-for-config_subscription'
This closes #12
Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
diff --git a/src/config_listener_mon.erl b/src/config_listener_mon.erl
index 036d17f..1037a80 100644
--- a/src/config_listener_mon.erl
+++ b/src/config_listener_mon.erl
@@ -16,7 +16,8 @@
-export([
- subscribe/2
+ subscribe/2,
+ start_link/2
]).
@@ -36,9 +37,14 @@
}).
-subscribe(Module, InitSt) ->
- proc_lib:start(?MODULE, init, [{self(), Module, InitSt}]).
+start_link(Module, InitSt) ->
+ proc_lib:start_link(?MODULE, init, [{self(), Module, InitSt}]).
+subscribe(Module, InitSt) ->
+ case proc_lib:start(?MODULE, init, [{self(), Module, InitSt}]) of
+ {ok, _} -> ok;
+ Else -> Else
+ end.
init({Pid, Mod, InitSt}) ->
Ref = erlang:monitor(process, Pid),
diff --git a/test/config_tests.erl b/test/config_tests.erl
index d3464e1..8293f2e 100644
--- a/test/config_tests.erl
+++ b/test/config_tests.erl
@@ -604,7 +604,7 @@
spawn_config_listener() ->
Self = self(),
Pid = erlang:spawn(fun() ->
- {ok, _} = config:listen_for_changes(?MODULE, {self(), undefined}),
+ ok = config:listen_for_changes(?MODULE, {self(), undefined}),
Self ! registered,
loop(undefined)
end),