You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/10/01 17:23:51 UTC

[GitHub] [couchdb] nickva commented on a change in pull request #3767: Add search to list of features in welcome response

nickva commented on a change in pull request #3767:
URL: https://github.com/apache/couchdb/pull/3767#discussion_r720418837



##########
File path: src/chttpd/src/chttpd_misc.erl
##########
@@ -60,7 +60,13 @@ handle_welcome_req(Req, _) ->
     send_method_not_allowed(Req, "GET,HEAD").
 
 get_features() ->
-    case clouseau_rpc:connected() of
+    Clouseau =
+        ['clouseau1@127.0.0.1', 'clouseau2@127.0.0.1', 'clouseau3@127.0.0.1'],
+    Connected = lists:foldl(
+        fun (X, Y) ->
+            clouseau_rpc:connected(X) orelse Y
+        end, false, Clouseau),
+    case Connected orelse clouseau_rpc:connected() of

Review comment:
       It doesn't seem right on first sight that we hard code 3 node names in the features list check.
   
   I'd think if there is a clouseau node configuration setting we should probably read that.
   
   Another idea would be to encapsulate this in the dreyfus app somewhere. Have some `dreyfus:feature_available/0 -> true|false` function perhaps, so the knowledge about the exact node names is hidden away from chttpd_misc module.
   
   The logic would be something like:
     * If dreyfus is enabled AND
     * We can connect to clouseau we show feature as enabled.
    
   I think we could probably add some caching and assume that if we could connect to it at least once in the past few minutes should be able to return true, otherwise return false. Since / endpoint ends up being hit unauthenticated we don't want to expose ourself to a DoS attack some some repeatedly flooding the dist connection to clouseau on every `GET /` request.
   
   My knowledge of search is limited, I think we may need some help from the @rnewson or @tonysun83 here




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org