Send a rexi reply when we receive attachment data and expect it
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/e7a45f37 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/e7a45f37 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/e7a45f37 Branch: refs/heads/import Commit: e7a45f3749cc3440ed7c4c2155979a5995123f69 Parents: ed385ea Author: Robert Newson <[email protected]> Authored: Mon Dec 17 16:54:51 2012 +0000 Committer: Robert Newson <[email protected]> Committed: Mon Dec 17 16:56:04 2012 +0000 ---------------------------------------------------------------------- src/fabric_doc_attachments.erl | 5 ++++- src/fabric_doc_update.erl | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/e7a45f37/src/fabric_doc_attachments.erl ---------------------------------------------------------------------- diff --git a/src/fabric_doc_attachments.erl b/src/fabric_doc_attachments.erl index 7abb459..c91995d 100644 --- a/src/fabric_doc_attachments.erl +++ b/src/fabric_doc_attachments.erl @@ -37,7 +37,9 @@ receiver(Req, Length) when is_integer(Length) -> fun() -> Middleman ! {self(), gimme_data}, receive - {Middleman, Data} -> iolist_to_binary(Data) + {Middleman, Data} -> + rexi:reply(attachment_chunk_received), + iolist_to_binary(Data) after 600000 -> exit(timeout) end @@ -66,6 +68,7 @@ write_chunks(MiddleMan, ChunkFun) -> MiddleMan ! {self(), gimme_data}, receive {MiddleMan, ChunkRecordList} -> + rexi:reply(attachment_chunk_received), case flush_chunks(ChunkRecordList, ChunkFun) of continue -> write_chunks(MiddleMan, ChunkFun); done -> ok http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/e7a45f37/src/fabric_doc_update.erl ---------------------------------------------------------------------- diff --git a/src/fabric_doc_update.erl b/src/fabric_doc_update.erl index 26da858..d984829 100644 --- a/src/fabric_doc_update.erl +++ b/src/fabric_doc_update.erl @@ -62,6 +62,8 @@ handle_message(internal_server_error, Worker, Acc0) -> {WC,LenDocs,W,GrpDocs,DocReplyDict} = Acc0, NewGrpDocs = lists:keydelete(Worker,1,GrpDocs), skip_message({WC-1,LenDocs,W,NewGrpDocs,DocReplyDict}); +handle_message(attachment_chunk_received, _Worker, Acc0) -> + {ok, Acc0}; handle_message({ok, Replies}, Worker, Acc0) -> {WaitingCount, DocCount, W, GroupedDocs, DocReplyDict0} = Acc0, {value, {_, Docs}, NewGrpDocs} = lists:keytake(Worker, 1, GroupedDocs),
