couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject couch-index commit: updated refs/heads/master to f0a6854
Date Thu, 24 Nov 2016 17:09:30 GMT
Repository: couchdb-couch-index
Updated Branches:
  refs/heads/master 53555fd90 -> f0a6854e5


Configurable timeout for view group get_info/1

A busy view group server might take longer than 5 seconds to respond, so make
the timeout configurable. "infinity" is also a valid configuration value.

Configuration section, key and default value (in milliseconds):

   `query_server_config.group_info_timeout = 5000`

COUCHDB-3242


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

Branch: refs/heads/master
Commit: f0a6854e578469612937a766632fdcdc52ee9c65
Parents: 53555fd
Author: Nick Vatamaniuc <vatamane@apache.org>
Authored: Wed Nov 23 23:05:00 2016 -0500
Committer: Nick Vatamaniuc <vatamane@apache.org>
Committed: Wed Nov 23 23:05:00 2016 -0500

----------------------------------------------------------------------
 src/couch_index.erl | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/f0a6854e/src/couch_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_index.erl b/src/couch_index.erl
index 57dddee..b339010 100644
--- a/src/couch_index.erl
+++ b/src/couch_index.erl
@@ -55,7 +55,7 @@ get_state(Pid, RequestSeq) ->
 
 
 get_info(Pid) ->
-    gen_server:call(Pid, get_info).
+    gen_server:call(Pid, get_info, group_info_timeout_msec()).
 
 
 trigger_update(Pid, UpdateSeq) ->
@@ -415,6 +415,16 @@ commit_delay() ->
     config:get_integer("query_server_config", "commit_freq", 5) * 1000.
 
 
+group_info_timeout_msec() ->
+    Timeout = config:get("query_server_config", "group_info_timeout", "5000"),
+    case Timeout of
+        "infinity" ->
+            infinity;
+        Milliseconds ->
+            list_to_integer(Milliseconds)
+    end.
+
+
 -ifdef(TEST).
 -include_lib("couch/include/couch_eunit.hrl").
 
@@ -532,4 +542,37 @@ test_id(Settings0) ->
     Settings1 = [to_string(Value) || Value <- Settings0],
     "[ " ++ lists:flatten(string:join(Settings1, " , ")) ++ " ]".
 
+
+get_group_timeout_info_test_() ->
+    {
+        foreach,
+        fun() -> ok end,
+        fun(_) -> meck:unload() end,
+        [
+            t_group_timeout_info_integer(),
+            t_group_timeout_info_infinity()
+        ]
+    }.
+
+
+t_group_timeout_info_integer() ->
+     ?_test(begin
+        meck:expect(config, get,
+            fun("query_server_config", "group_info_timeout", _) ->
+               "5001"
+            end),
+        ?assertEqual(5001, group_info_timeout_msec())
+    end).
+
+
+t_group_timeout_info_infinity() ->
+     ?_test(begin
+        meck:expect(config, get,
+            fun("query_server_config", "group_info_timeout", _) ->
+                "infinity"
+            end),
+        ?assertEqual(infinity, group_info_timeout_msec())
+    end).
+
+
 -endif.


Mime
View raw message