From e4470d5017f098af9a9d7b3c0d92362d8eb90cce Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Wed, 18 Aug 2010 10:40:06 -0400 Subject: slightly better rexi_EXIT handling, needs more work --- apps/fabric/src/fabric_doc_update.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apps/fabric/src/fabric_doc_update.erl') diff --git a/apps/fabric/src/fabric_doc_update.erl b/apps/fabric/src/fabric_doc_update.erl index c6ceaeab..50d02888 100644 --- a/apps/fabric/src/fabric_doc_update.erl +++ b/apps/fabric/src/fabric_doc_update.erl @@ -44,7 +44,13 @@ go(DbName, AllDocs, Opts) -> handle_message({rexi_DOWN, _, _, _}, _Worker, Acc0) -> skip_message(Acc0); handle_message({rexi_EXIT, _}, _Worker, Acc0) -> - skip_message(Acc0); + {WaitingCount, _, W, _, DocReplyDict} = Acc0, + if WaitingCount =:= 1 -> + {W, Reply} = dict:fold(fun force_reply/3, {W,[]}, DocReplyDict), + {stop, Reply}; + true -> + {ok, setelement(1, Acc0, WaitingCount-1)} + end; handle_message({ok, Replies}, Worker, Acc0) -> {WaitingCount, DocCount, W, GroupedDocs, DocReplyDict0} = Acc0, Docs = couch_util:get_value(Worker, GroupedDocs), -- cgit v1.2.3