Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B27B8200BCB for ; Thu, 24 Nov 2016 18:09:31 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id B0CE6160AFB; Thu, 24 Nov 2016 17:09:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 08828160B1E for ; Thu, 24 Nov 2016 18:09:30 +0100 (CET) Received: (qmail 73764 invoked by uid 500); 24 Nov 2016 17:09:30 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 73755 invoked by uid 99); 24 Nov 2016 17:09:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Nov 2016 17:09:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 170BADFCC7; Thu, 24 Nov 2016 17:09:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vatamane@apache.org To: commits@couchdb.apache.org Message-Id: <5bcf73d4e82f4c04bd1dfb0c361f2792@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: couch-index commit: updated refs/heads/master to f0a6854 Date: Thu, 24 Nov 2016 17:09:30 +0000 (UTC) archived-at: Thu, 24 Nov 2016 17:09:31 -0000 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 Authored: Wed Nov 23 23:05:00 2016 -0500 Committer: Nick Vatamaniuc 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.