Github user chewbranca commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/107#discussion_r41804497
--- Diff: src/couch_query_servers.erl ---
@@ -280,12 +287,23 @@ validate_doc_update(DDoc, EditDoc, DiskDoc, Ctx,
SecObj) ->
throw({unknown_error, Message})
end.
-json_doc(nil) -> null;
+json_doc_options() ->
+ json_doc_options([]).
+
+json_doc_options(Options) ->
+ Limit = config:get_integer("query_server_config", "revs_limit", 20),
+ [{revs, Limit} | Options].
+
json_doc(Doc) ->
- couch_doc:to_json_obj(Doc, [revs]).
+ json_doc(Doc, json_doc_options()).
--- End diff --
I disagree, I took it out intentionally. I'm not a fan of duplicating that
logic; the one arity `json_doc` function now exists to add default options, and
should do nothing else. The two arity version handles all the actual logic. I
did consider the impact of adding the extra config lookup before short
circuiting on `nil`, but I don't think we should be worrying about the speed of
config lookups from ETS in general, especially at the expense of clarity in the
code.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---