Use `define` to avoid repeating yourself COUCHDB-3102
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/7b827534 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/7b827534 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/7b827534 Branch: refs/heads/master Commit: 7b827534e8e5f7d1cb8dd2cebd0ec003165690b2 Parents: 72dfb85 Author: ILYA Khlopotov <[email protected]> Authored: Tue Aug 23 13:17:31 2016 -0700 Committer: ILYA Khlopotov <[email protected]> Committed: Tue Aug 23 13:17:31 2016 -0700 ---------------------------------------------------------------------- src/couch_index.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/7b827534/src/couch_index.erl ---------------------------------------------------------------------- diff --git a/src/couch_index.erl b/src/couch_index.erl index fdc7246..a5958b9 100644 --- a/src/couch_index.erl +++ b/src/couch_index.erl @@ -31,6 +31,7 @@ -define(CHECK_INTERVAL, 600000). % 10 minutes -define(RELISTEN_DELAY, 5000). +-define(CONFIG_SUBSCRIPTION, [{"query_server_config", "commit_freq"}]). -record(st, { mod, @@ -85,7 +86,7 @@ config_change("query_server_config", "commit_freq", NewValue) -> init({Mod, IdxState}) -> - ok = config:subscribe_for_changes([{"query_server_config", "commit_freq"}]), + ok = config:subscribe_for_changes(?CONFIG_SUBSCRIPTION), DbName = Mod:get(db_name, IdxState), erlang:send_after(?CHECK_INTERVAL, self(), maybe_close), Resp = couch_util:with_db(DbName, fun(Db) -> @@ -347,7 +348,7 @@ handle_info({gen_event_EXIT, _Handler, _Reason}, State) -> erlang:send_after(?RELISTEN_DELAY, self(), restart_config_listener), {noreply, State}; handle_info(restart_config_listener, State) -> - ok = config:subscribe_for_changes([{"query_server_config", "commit_freq"}]), + ok = config:subscribe_for_changes(?CONFIG_SUBSCRIPTION), {noreply, State}. code_change(_OldVsn, State, _Extra) ->
