couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [2/3] mem3 commit: updated refs/heads/master to 7f59504
Date Wed, 04 Feb 2015 15:49:42 GMT
Update config_listener behaviuor

COUCHDB-2561


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/7a66ec19
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/7a66ec19
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/7a66ec19

Branch: refs/heads/master
Commit: 7a66ec197ccf3a4f2e1d071e662d35bf3a65d58f
Parents: 3f229b2
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Thu Jan 29 13:55:48 2015 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Wed Feb 4 06:12:41 2015 -0800

----------------------------------------------------------------------
 src/mem3_shards.erl | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/7a66ec19/src/mem3_shards.erl
----------------------------------------------------------------------
diff --git a/src/mem3_shards.erl b/src/mem3_shards.erl
index 7583db9..e8b8746 100644
--- a/src/mem3_shards.erl
+++ b/src/mem3_shards.erl
@@ -12,12 +12,12 @@
 
 -module(mem3_shards).
 -behaviour(gen_server).
--vsn(1).
+-vsn(2).
 -behaviour(config_listener).
 
 -export([init/1, terminate/2, code_change/3]).
 -export([handle_call/3, handle_cast/2, handle_info/2]).
--export([handle_config_change/5]).
+-export([handle_config_change/5, handle_config_terminate/3]).
 
 -export([start_link/0]).
 -export([for_db/1, for_db/2, for_docid/2, for_docid/3, get/3, local/1, fold/2]).
@@ -136,6 +136,12 @@ handle_config_change("mem3", "shard_db", _DbName, _, _) ->
 handle_config_change(_, _, _, _, _) ->
     {ok, nil}.
 
+handle_config_terminate(_, _, _) ->
+    spawn(fun() ->
+        timer:sleep(5000),
+        config:listen_for_changes(?MODULE, nil)
+    end).
+
 init([]) ->
     ets:new(?SHARDS, [bag, protected, named_table, {keypos,#shard.dbname}]),
     ets:new(?DBS, [set, protected, named_table]),
@@ -185,12 +191,6 @@ handle_info({'DOWN', _, _, Pid, Reason}, #st{changes_pid=Pid}=St) ->
 handle_info({start_listener, Seq}, St) ->
     {NewPid, _} = spawn_monitor(fun() -> listen_for_changes(Seq) end),
     {noreply, St#st{changes_pid=NewPid}};
-handle_info({gen_event_EXIT, {config_listener, ?MODULE}, _Reason}, State) ->
-    erlang:send_after(5000, self(), restart_config_listener),
-    {noreply, State};
-handle_info(restart_config_listener, State) ->
-    ok = config:listen_for_changes(?MODULE, nil),
-    {noreply, State};
 handle_info(_Msg, St) ->
     {noreply, St}.
 


Mime
View raw message