You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2023/11/30 15:51:06 UTC
(couchdb) branch main updated (3d60e4136 -> 70d903512)
This is an automated email from the ASF dual-hosted git repository.
jan pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
from 3d60e4136 Handle ddocs fetch timeouts in ken
new 7711c7389 Look up search node name in config for weatherreport
new 70d903512 Use list_to_existing_atom/1 to convert `[dreyfus] name` value for ping check
The 2 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.
Summary of changes:
.../src/weatherreport_check_search.erl | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
(couchdb) 01/02: Look up search node name in config for weatherreport
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 7711c7389f6a9588277b776528e819ffe5c89f3a
Author: James Coglan <ja...@neighbourhood.ie>
AuthorDate: Thu Nov 30 10:35:47 2023 +0000
Look up search node name in config for weatherreport
Weatherreport is hard-coded to assume the search node is at
'clouseau@127.0.0.1' and that it is running. This results in a useless
warning for users that do not have search enabled, and also means that
it will fail to connect if Clouseau is running somewhere other than
127.0.0.1.
This replaces the hard-coded node name with a config lookup to
`[dreyfus] name` and handles the case of it not being set.
---
.../src/weatherreport_check_search.erl | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/weatherreport/src/weatherreport_check_search.erl b/src/weatherreport/src/weatherreport_check_search.erl
index b7986db2b..39ec3ca63 100644
--- a/src/weatherreport/src/weatherreport_check_search.erl
+++ b/src/weatherreport/src/weatherreport_check_search.erl
@@ -44,16 +44,24 @@ valid() ->
-spec check(list()) -> [{atom(), term()}].
check(_Opts) ->
- SearchNode = 'clouseau@127.0.0.1',
- case net_adm:ping(SearchNode) of
- pong ->
- [{info, {clouseau_ok, SearchNode}}];
- Error ->
- % only warning since search is not enabled by default
- [{warning, {clouseau_error, SearchNode, Error}}]
+ SearchNodeStr = config:get("dreyfus", "name"),
+ case SearchNodeStr of
+ undefined ->
+ [{info, clouseau_not_configured}];
+ _ ->
+ SearchNode = list_to_atom(SearchNodeStr),
+ case net_adm:ping(SearchNode) of
+ pong ->
+ [{info, {clouseau_ok, SearchNode}}];
+ Error ->
+ % only warning since search is not enabled by default
+ [{warning, {clouseau_error, SearchNode, Error}}]
+ end
end.
-spec format(term()) -> {io:format(), [term()]}.
+format(clouseau_not_configured) ->
+ {"Clouseau service is not configured", []};
format({clouseau_ok, SearchNode}) ->
{"Local search node at ~w responding ok", [SearchNode]};
format({clouseau_error, SearchNode, Error}) ->
(couchdb) 02/02: Use list_to_existing_atom/1 to convert `[dreyfus] name` value for ping check
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 70d903512b7ebb2ef7e1eff1d1e72336e0616f28
Author: James Coglan <ja...@neighbourhood.ie>
AuthorDate: Thu Nov 30 15:05:06 2023 +0000
Use list_to_existing_atom/1 to convert `[dreyfus] name` value for ping check
---
.../src/weatherreport_check_search.erl | 25 ++++++++++++++++------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/weatherreport/src/weatherreport_check_search.erl b/src/weatherreport/src/weatherreport_check_search.erl
index 39ec3ca63..ba045658a 100644
--- a/src/weatherreport/src/weatherreport_check_search.erl
+++ b/src/weatherreport/src/weatherreport_check_search.erl
@@ -49,20 +49,31 @@ check(_Opts) ->
undefined ->
[{info, clouseau_not_configured}];
_ ->
- SearchNode = list_to_atom(SearchNodeStr),
- case net_adm:ping(SearchNode) of
- pong ->
- [{info, {clouseau_ok, SearchNode}}];
- Error ->
- % only warning since search is not enabled by default
- [{warning, {clouseau_error, SearchNode, Error}}]
+ try list_to_existing_atom(SearchNodeStr) of
+ SearchNode ->
+ ping_search_node(SearchNode)
+ catch
+ error:badarg ->
+ [{warning, {clouseau_node, SearchNodeStr}}]
end
end.
+-spec ping_search_node(atom()) -> [{atom(), term()}].
+ping_search_node(SearchNode) ->
+ case net_adm:ping(SearchNode) of
+ pong ->
+ [{info, {clouseau_ok, SearchNode}}];
+ Error ->
+ % only warning since search is not enabled by default
+ [{warning, {clouseau_error, SearchNode, Error}}]
+ end.
+
-spec format(term()) -> {io:format(), [term()]}.
format(clouseau_not_configured) ->
{"Clouseau service is not configured", []};
format({clouseau_ok, SearchNode}) ->
{"Local search node at ~w responding ok", [SearchNode]};
+format({clouseau_node, SearchNode}) ->
+ {"Search node name ~s is not recognised", [SearchNode]};
format({clouseau_error, SearchNode, Error}) ->
{"Local search node at ~w not responding: ~w", [SearchNode, Error]}.