You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by iilyak <gi...@git.apache.org> on 2016/08/19 20:01:11 UTC

[GitHub] couchdb-couch pull request #192: Update handle_config_terminate API

GitHub user iilyak opened a pull request:

    https://github.com/apache/couchdb-couch/pull/192

    Update handle_config_terminate API

    Update handle_config_terminate API to match changes in https://github.com/apache/couchdb-config/pull/11
    
    COUCHDB-3102

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cloudant/couchdb-couch 3102-fix-config_subscription

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-couch/pull/192.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #192
    
----
commit 998b466e6e8b6c7370ad4ca84b24a4550a42bfce
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date:   2016-08-17T18:24:08Z

    Update handle_config_terminate API
    
    COUCHDB-3102

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch issue #192: Update handle_config_terminate API

Posted by davisp <gi...@git.apache.org>.
Github user davisp commented on the issue:

    https://github.com/apache/couchdb-couch/pull/192
  
    Just had the one trivial comment. If you prefer the existing approach feel free to ignore my suggestion.
    
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request #192: Update handle_config_terminate API

Posted by davisp <gi...@git.apache.org>.
Github user davisp commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/192#discussion_r76070340
  
    --- Diff: src/couch_external_server.erl ---
    @@ -40,47 +38,52 @@ execute(Pid, JsonReq) ->
     init([Name, Command]) ->
         couch_log:info("EXTERNAL: Starting process for: ~s", [Name]),
         couch_log:info("COMMAND: ~s", [Command]),
    +    ok = config:subscribe_for_changes([{"couchdb", "os_process_timeout"}]),
         process_flag(trap_exit, true),
         Timeout = list_to_integer(config:get("couchdb", "os_process_timeout",
             "5000")),
         {ok, Pid} = couch_os_process:start_link(Command, [{timeout, Timeout}]),
    -    ok = config:listen_for_changes(?MODULE, Pid),
    -    {ok, {Name, Command, Pid}}.
    +    {ok, {Name, Command, Pid, whereis(config_event)}}.
    --- End diff --
    
    It occurs to me that my idea is dumb. By the time we get the EXIT message thr whereis will either fail or give a new pid. I think state is best like you have it already. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request #192: Update handle_config_terminate API

Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/192#discussion_r75937876
  
    --- Diff: src/couch_external_server.erl ---
    @@ -40,47 +38,52 @@ execute(Pid, JsonReq) ->
     init([Name, Command]) ->
         couch_log:info("EXTERNAL: Starting process for: ~s", [Name]),
         couch_log:info("COMMAND: ~s", [Command]),
    +    ok = config:subscribe_for_changes([{"couchdb", "os_process_timeout"}]),
         process_flag(trap_exit, true),
         Timeout = list_to_integer(config:get("couchdb", "os_process_timeout",
             "5000")),
         {ok, Pid} = couch_os_process:start_link(Command, [{timeout, Timeout}]),
    -    ok = config:listen_for_changes(?MODULE, Pid),
    -    {ok, {Name, Command, Pid}}.
    +    {ok, {Name, Command, Pid, whereis(config_event)}}.
    --- End diff --
    
    > @davisp:  and if we get an unknown 'EXIT' message we just erlang:error on it.
    We need config_event Pid to be able to distinguish among EXIT messages.
    
    Rather then updating state I also considered keep Pid in the process dictionary. Let me know if you like it better.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request #192: Update handle_config_terminate API

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/couchdb-couch/pull/192


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request #192: Update handle_config_terminate API

Posted by davisp <gi...@git.apache.org>.
Github user davisp commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/192#discussion_r75914190
  
    --- Diff: src/couch_external_server.erl ---
    @@ -40,47 +38,52 @@ execute(Pid, JsonReq) ->
     init([Name, Command]) ->
         couch_log:info("EXTERNAL: Starting process for: ~s", [Name]),
         couch_log:info("COMMAND: ~s", [Command]),
    +    ok = config:subscribe_for_changes([{"couchdb", "os_process_timeout"}]),
         process_flag(trap_exit, true),
         Timeout = list_to_integer(config:get("couchdb", "os_process_timeout",
             "5000")),
         {ok, Pid} = couch_os_process:start_link(Command, [{timeout, Timeout}]),
    -    ok = config:listen_for_changes(?MODULE, Pid),
    -    {ok, {Name, Command, Pid}}.
    +    {ok, {Name, Command, Pid, whereis(config_event)}}.
    --- End diff --
    
    Seems like a lot of extra work just for that one 'EXIT' clause. I do see that without it we'd enter that clause for any 'EXIT' rather than throwing a function clause error. Though given that its rare I'd probably just undo the state tuple change and if we get an unknown 'EXIT' message we just erlang:error on it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---