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/24 20:50:12 UTC

[couchdb] branch list-search-in-features created (now a540b94)

This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a change to branch list-search-in-features
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at a540b94  Include search in the list of advertised features

This branch includes the following new commits:

     new a540b94  Include search in the list of advertised features

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Include search in the list of advertised features

Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch list-search-in-features
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit a540b948524ce8ae860abd398c7af59c92bd2258
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Tue Sep 24 16:43:45 2019 -0400

    Include search in the list of advertised features
    
    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()).