rnewson commented on code in PR #5601:
URL: https://github.com/apache/couchdb/pull/5601#discussion_r2219452353


##########
src/nouveau/src/nouveau_gun.erl:
##########
@@ -36,20 +36,32 @@
 
 -define(NOUVEAU_HOST_HEADER, nouveau_host_header).
 
+-record(state, {
+    enabled,
+    url
+}).
+
 start_link() ->
     gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
 
 host_header() ->
     persistent_term:get(?NOUVEAU_HOST_HEADER).
 
 init(_) ->
+    Enabled = nouveau:enabled(),
     URL = nouveau_util:nouveau_url(),
-    case start_gun(URL) of
-        {ok, _PoolPid} ->
-            ok = config:listen_for_changes(?MODULE, URL),
-            {ok, nil};
-        {error, Reason} ->
-            {error, Reason}
+    State = #state{enabled = Enabled, url = URL},
+    ok = config:listen_for_changes(?MODULE, State),
+    if
+        Enabled ->
+            case start_gun(URL) of
+                {ok, _PoolPid} ->
+                    {ok, nil};
+                {error, Reason} ->
+                    {error, Reason}
+            end;
+        true ->
+            {ok, nil}

Review Comment:
   nice ideas, updated.



-- 
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-unsubscr...@couchdb.apache.org

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

Reply via email to