You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2019/09/25 16:29:01 UTC
[couchdb] branch master updated: Include search in the list of
advertised features (#2206)
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/master by this push:
new 77f64b4 Include search in the list of advertised features (#2206)
77f64b4 is described below
commit 77f64b4f4beb1b8ee7449cf2ff73d7f162366229
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Wed Sep 25 12:28:55 2019 -0400
Include search in the list of advertised features (#2206)
The reason we don't do this in config:features() directly is because
this one is a dynamic check for the presence of a connected clouseau
node. Calling `enable_feature` every time we conduct that check seemed
too heavyweight, but I didn't see a good opportunity to just call it
once and be confident that it would reliably advertise the feature.
The downside here is that CouchDB will not advertise the "search"
feature if Clouseau is disconnected for maintenance or whatever,
although technically it's accurate since search requests submitted
during that interval would fail.
Closes #2205
---
src/chttpd/src/chttpd_misc.erl | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl
index 819d782..17122bf 100644
--- a/src/chttpd/src/chttpd_misc.erl
+++ b/src/chttpd/src/chttpd_misc.erl
@@ -51,7 +51,7 @@ handle_welcome_req(#httpd{method='GET'}=Req, WelcomeMessage) ->
{version, list_to_binary(couch_server:get_version())},
{git_sha, list_to_binary(couch_server:get_git_sha())},
{uuid, couch_server:get_uuid()},
- {features, config:features()}
+ {features, get_features()}
] ++ case config:get("vendor") of
[] ->
[];
@@ -62,6 +62,14 @@ handle_welcome_req(#httpd{method='GET'}=Req, WelcomeMessage) ->
handle_welcome_req(Req, _) ->
send_method_not_allowed(Req, "GET,HEAD").
+get_features() ->
+ case clouseau_rpc:connected() of
+ true ->
+ [search | config:features()];
+ false ->
+ config:features()
+ end.
+
handle_favicon_req(Req) ->
handle_favicon_req(Req, get_docroot()).