Use `define` to avoid repeating yourself COUCHDB-3102
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/a701c4b7 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/a701c4b7 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/a701c4b7 Branch: refs/heads/master Commit: a701c4b73640f74e80245a8c262e1a2d583f2290 Parents: 608942f Author: ILYA Khlopotov <iil...@ca.ibm.com> Authored: Tue Aug 23 13:15:57 2016 -0700 Committer: ILYA Khlopotov <iil...@ca.ibm.com> Committed: Tue Aug 23 13:18:15 2016 -0700 ---------------------------------------------------------------------- src/couch_external_server.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/a701c4b7/src/couch_external_server.erl ---------------------------------------------------------------------- diff --git a/src/couch_external_server.erl b/src/couch_external_server.erl index 0e01cf3..e2a5022 100644 --- a/src/couch_external_server.erl +++ b/src/couch_external_server.erl @@ -20,6 +20,7 @@ -include_lib("couch/include/couch_db.hrl"). -define(RELISTEN_DELAY, 5000). +-define(CONFIG_SUBSCRIPTION, [{"couchdb", "os_process_timeout"}]). % External API @@ -38,7 +39,7 @@ 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"}]), + ok = config:subscribe_for_changes(?CONFIG_SUBSCRIPTION), process_flag(trap_exit, true), Timeout = list_to_integer(config:get("couchdb", "os_process_timeout", "5000")), @@ -74,7 +75,7 @@ handle_info(restart_config_listener, {Name, Command, Pid, _} = State) -> erlang:send_after(?RELISTEN_DELAY, self(), restart_config_listener), {noreply, State}; EventMgr -> - ok = config:subscribe_for_changes([{"couchdb", "os_process_timeout"}]), + ok = config:subscribe_for_changes(?CONFIG_SUBSCRIPTION), {noreply, {Name, Command, Pid, EventMgr}} end.