Repository: couchdb-config Updated Branches: refs/heads/master 47e5f7016 -> b615eedb5
Add config_listener_mon:start_link/2 This a fixup commit for f09a2eb7d COUCHDB-3102 Project: http://git-wip-us.apache.org/repos/asf/couchdb-config/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-config/commit/144da209 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-config/tree/144da209 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-config/diff/144da209 Branch: refs/heads/master Commit: 144da209b5704539dec757a2c2070bb4b6525745 Parents: 47e5f70 Author: ILYA Khlopotov <[email protected]> Authored: Tue Aug 23 16:01:48 2016 -0700 Committer: ILYA Khlopotov <[email protected]> Committed: Tue Aug 23 16:03:11 2016 -0700 ---------------------------------------------------------------------- src/config_listener_mon.erl | 12 +++++++++--- test/config_tests.erl | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-config/blob/144da209/src/config_listener_mon.erl ---------------------------------------------------------------------- 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), http://git-wip-us.apache.org/repos/asf/couchdb-config/blob/144da209/test/config_tests.erl ---------------------------------------------------------------------- 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 @@ should_not_add_duplicate(_, _) -> 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),
