nickva commented on code in PR #5556:
URL: https://github.com/apache/couchdb/pull/5556#discussion_r2121573559
##########
src/ddoc_cache/src/ddoc_cache_entry_validation_funs.erl:
##########
@@ -27,16 +27,21 @@ ddocid(_) ->
recover(DbName) ->
{ok, DDocs} = fabric:design_docs(mem3:dbname(DbName)),
- Funs = lists:flatmap(
- fun(DDoc) ->
- case couch_doc:get_validate_doc_fun(DbName, DDoc) of
- nil -> [];
- Fun -> [Fun]
- end
- end,
- DDocs
- ),
- {ok, Funs}.
+ case is_list(DDocs) of
Review Comment:
I think we'd want to mention in a comment why we're doing this --
`all_docs()` and by extension `design_docs()` have an odd behavior that they
can return an `{ok, Error|DDocsList}` tuple where Error can be anything.
Normally we should expect these things to return an `{error, Error}` and we can
also have that here too.
This comes from
https://github.com/apache/couchdb/blob/9da7be8e9660caa0e3c78e0cd36e180817bb827b/src/fabric/src/fabric_view_all_docs.erl#L154-L155
and I don't fully understand the reason for it
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]