summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Avdey <eiri@eiri.ca>2019-08-28 19:33:33 -0300
committerEric Avdey <eiri@eiri.ca>2019-08-28 19:33:33 -0300
commitea5661dccebc1f04c8012fe8e3d15ae8f6a57c4b (patch)
tree010355c18bd3437ec717ec65d157bc4843c742a3
parent4f3e4d08dce7b9a64364724678fd4bb59f75ed82 (diff)
downloadcouchdb-fix-all-docs-timeout.tar.gz
Fix badmatch in fabric_view_all_docsfix-all-docs-timeout
In query for all_docs with passed keys array it is possible for `doc_receive_loop/6` to timeout and trigger `badmatch` exception. The fix changes code to to accept `timeout` as a possible response and passes it to Callback to process.
-rw-r--r--src/fabric/src/fabric_view_all_docs.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/fabric/src/fabric_view_all_docs.erl b/src/fabric/src/fabric_view_all_docs.erl
index 1d87e3ddd..5fe143731 100644
--- a/src/fabric/src/fabric_view_all_docs.erl
+++ b/src/fabric/src/fabric_view_all_docs.erl
@@ -104,10 +104,15 @@ go(DbName, Options, QueryArgs, Callback, Acc0) ->
[{total, TotalRows}, {offset, null}, {update_seq, null}]
end,
{ok, Acc1} = Callback({meta, Meta}, Acc0),
- {ok, Acc2} = doc_receive_loop(
+ Resp = doc_receive_loop(
Keys3, queue:new(), SpawnFun, MaxJobs, Callback, Acc1
),
- Callback(complete, Acc2);
+ case Resp of
+ {ok, Acc2} ->
+ Callback(complete, Acc2);
+ timeout ->
+ Callback(timeout, Acc0)
+ end;
{'DOWN', Ref, _, _, Error} ->
Callback({error, Error}, Acc0)
after Timeout ->