diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2009-10-02 00:27:48 +0000 |
---|---|---|
committer | Adam Kocoloski <kocolosk@apache.org> | 2009-10-02 00:27:48 +0000 |
commit | 6bcdf27022bd3992685a0188c3025aacfc35de5c (patch) | |
tree | cb38977bfe1aecf9e702103372240d45d60304d2 | |
parent | c2d8ffd2069ac35beb0ecf0938f277bffeb0f193 (diff) |
replication bugfixes, see COUCHDB-516
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@820851 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/couchdb/couch_rep_changes_feed.erl | 2 | ||||
-rw-r--r-- | src/couchdb/couch_rep_reader.erl | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/couchdb/couch_rep_changes_feed.erl b/src/couchdb/couch_rep_changes_feed.erl index 0c04ff61..4f56454d 100644 --- a/src/couchdb/couch_rep_changes_feed.erl +++ b/src/couchdb/couch_rep_changes_feed.erl @@ -298,7 +298,7 @@ by_seq_loop(Server, Source, StartSeq) -> end, 0, Rows), by_seq_loop(Server, Source, EndSeq). -decode_row(<<",\n", Rest/binary>>) -> +decode_row(<<",", Rest/binary>>) -> decode_row(Rest); decode_row(Row) -> {Props} = ?JSON_DECODE(Row), diff --git a/src/couchdb/couch_rep_reader.erl b/src/couchdb/couch_rep_reader.erl index a7c3fd9f..e0ebc2f0 100644 --- a/src/couchdb/couch_rep_reader.erl +++ b/src/couchdb/couch_rep_reader.erl @@ -32,7 +32,7 @@ source, missing_revs, reader_loop, - reader_from = nil, + reader_from = [], count = 0, docs = queue:new(), reply_to = nil, @@ -107,7 +107,7 @@ handle_add_docs(Seq, DocsToAdd, From, #state{reply_to=nil} = State) -> if NewState#state.count < ?BUFFER_SIZE -> {reply, ok, NewState}; true -> - {noreply, NewState#state{reader_from=From}} + {noreply, NewState#state{reader_from=[From|State#state.reader_from]}} end; handle_add_docs(Seq, DocsToAdd, _From, #state{count=0} = State) -> NewState = update_sequence_lists(Seq, State), @@ -126,10 +126,8 @@ handle_next_docs(_From, State) -> reader_from = ReaderFrom, docs = Docs } = State, - if ReaderFrom =/= nil -> - gen_server:reply(ReaderFrom, ok); - true -> ok end, - NewState = State#state{count=0, reader_from=nil, docs=queue:new()}, + [gen_server:reply(F, ok) || F <- ReaderFrom], + NewState = State#state{count=0, reader_from=[], docs=queue:new()}, {reply, {calculate_new_high_seq(State), queue:to_list(Docs)}, NewState}. handle_open_remote_doc(Id, Seq, Revs, From, #state{monitor_count=N} = State) |