Skip to content
This repository was archived by the owner on Sep 19, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/fabric_view_all_docs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,15 @@ doc_receive_loop(Keys, Pids, SpawnFun, MaxJobs, Callback, AccIn) ->
doc_receive_loop(RKeys, Pids1, SpawnFun, MaxJobs, Callback, AccIn);
_ ->
{{value, {Pid, Ref}}, RestPids} = queue:out(Pids),
receive {'DOWN', Ref, process, Pid, #view_row{} = Row} ->
case Callback(fabric_view:transform_row(Row), AccIn) of
receive
{'DOWN', Ref, process, Pid, Reason} ->
case Reason of
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the 'NewRow = case Reason of' style rather than assigning a value in every branch, seems less surprising.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I do too, and flymake complains about exported symbols, but as far as I know this is the preferred Cloudant approach.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, but I'll wait for other commenters.

#view_row{} = Row ->
NewRow = Row;
{{illegal_docid, Id}, _} ->
NewRow = #view_row{key = Id, doc = undefined}
end,
case Callback(fabric_view:transform_row(NewRow), AccIn) of
{ok, Acc} ->
doc_receive_loop(
Keys, RestPids, SpawnFun, MaxJobs, Callback, Acc
Expand Down