You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ii...@apache.org on 2016/08/23 22:04:17 UTC
[1/3] couchdb-ioq git commit: Update handle_config_terminate API
Repository: couchdb-ioq
Updated Branches:
refs/heads/master c7c75ebea -> ba99ec70d
Update handle_config_terminate API
COUCHDB-3102
Project: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/commit/bdcfe6aa
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/tree/bdcfe6aa
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/diff/bdcfe6aa
Branch: refs/heads/master
Commit: bdcfe6aa3a33c28411f0e4b9b121fff33474c3eb
Parents: c7c75eb
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Mon Aug 22 14:42:07 2016 -0700
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Tue Aug 23 12:43:35 2016 -0700
----------------------------------------------------------------------
src/ioq.erl | 16 +++++++++-------
src/ioq_sup.erl | 23 ++++++++++++++++++++++-
2 files changed, 31 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-ioq/blob/bdcfe6aa/src/ioq.erl
----------------------------------------------------------------------
diff --git a/src/ioq.erl b/src/ioq.erl
index 967a49b..93377d6 100644
--- a/src/ioq.erl
+++ b/src/ioq.erl
@@ -20,6 +20,8 @@
% config_listener api
-export([handle_config_change/5, handle_config_terminate/3]).
+-define(RELISTEN_DELAY, 5000).
+
-record(state, {
concurrency,
ratio,
@@ -83,6 +85,9 @@ handle_info({'DOWN', Ref, _, _, Reason}, State) ->
false ->
{noreply, State, 0}
end;
+handle_info(restart_config_listener, State) ->
+ ok = config:listen_for_changes(?MODULE, nil),
+ {noreply, State};
handle_info(timeout, State) ->
{noreply, maybe_submit_request(State)}.
@@ -91,13 +96,10 @@ handle_config_change("ioq", _, _, _, _) ->
handle_config_change(_, _, _, _, _) ->
{ok, nil}.
-handle_config_terminate(_, stop, _) -> ok;
-handle_config_terminate(_, _, _) ->
- spawn(fun() ->
- timer:sleep(5000),
- config:listen_for_changes(?MODULE, nil)
- end),
- ok.
+handle_config_terminate(_Server, stop, _State) ->
+ ok;
+handle_config_terminate(_Server, _Reason, _State) ->
+ erlang:send_after(?RELISTEN_DELAY, whereis(?MODULE), restart_config_listener).
code_change(_Vsn, State, _Extra) ->
{ok, State}.
http://git-wip-us.apache.org/repos/asf/couchdb-ioq/blob/bdcfe6aa/src/ioq_sup.erl
----------------------------------------------------------------------
diff --git a/src/ioq_sup.erl b/src/ioq_sup.erl
index c4d04a9..56e51ae 100644
--- a/src/ioq_sup.erl
+++ b/src/ioq_sup.erl
@@ -13,6 +13,7 @@
-module(ioq_sup).
-behaviour(supervisor).
-export([start_link/0, init/1]).
+-export([handle_config_change/5, handle_config_terminate/3]).
%% Helper macro for declaring children of supervisor
-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
@@ -21,4 +22,24 @@ start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
- {ok, { {one_for_one, 5, 10}, [?CHILD(ioq, worker)]}}.
+ {ok, { {one_for_one, 5, 10}, [
+ {
+ config_listener_mon,
+ {config_listener_mon, start_link, [?MODULE, nil]},
+ permanent,
+ 5000,
+ worker,
+ [config_listener_mon]
+ },
+ ?CHILD(ioq_server, worker)
+ ]} }.
+
+handle_config_change("ioq", _Key, _Val, _Persist, St) ->
+ gen_server:cast(ioq_server, update_config),
+ {ok, St};
+handle_config_change(_Sec, _Key, _Val, _Persist, St) ->
+ {ok, St}.
+
+handle_config_terminate(_Server, _Reason, _State) ->
+ gen_server:cast(ioq_server, update_config),
+ ok.
[2/3] couchdb-ioq git commit: Fix a typo in a child name
Posted by ii...@apache.org.
Fix a typo in a child name
COUCHDB-3102
Project: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/commit/126a849f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/tree/126a849f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/diff/126a849f
Branch: refs/heads/master
Commit: 126a849fa394f336bc769e85adad143a651c4ec1
Parents: bdcfe6a
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Tue Aug 23 14:23:24 2016 -0700
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Tue Aug 23 14:25:27 2016 -0700
----------------------------------------------------------------------
src/ioq_sup.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-ioq/blob/126a849f/src/ioq_sup.erl
----------------------------------------------------------------------
diff --git a/src/ioq_sup.erl b/src/ioq_sup.erl
index 56e51ae..fa919e4 100644
--- a/src/ioq_sup.erl
+++ b/src/ioq_sup.erl
@@ -31,7 +31,7 @@ init([]) ->
worker,
[config_listener_mon]
},
- ?CHILD(ioq_server, worker)
+ ?CHILD(ioq, worker)
]} }.
handle_config_change("ioq", _Key, _Val, _Persist, St) ->
[3/3] couchdb-ioq git commit: Merge remote branch
'cloudant:3102-fix-config_subscription'
Posted by ii...@apache.org.
Merge remote branch 'cloudant:3102-fix-config_subscription'
This closes #4
Signed-off-by: ILYA Khlopotov <ii...@ca.ibm.com>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/commit/ba99ec70
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/tree/ba99ec70
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ioq/diff/ba99ec70
Branch: refs/heads/master
Commit: ba99ec70d31cf82fe4868ab4bb92b0978f4fe67f
Parents: c7c75eb 126a849
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Authored: Tue Aug 23 14:59:51 2016 -0700
Committer: ILYA Khlopotov <ii...@ca.ibm.com>
Committed: Tue Aug 23 14:59:51 2016 -0700
----------------------------------------------------------------------
src/ioq.erl | 16 +++++++++-------
src/ioq_sup.erl | 23 ++++++++++++++++++++++-
2 files changed, 31 insertions(+), 8 deletions(-)
----------------------------------------------------------------------