diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-09-14 23:56:24 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-09-14 23:56:24 +0000 |
commit | fcc57720c9088dbd28904b6e614e8363b945c452 (patch) | |
tree | b03e825df4ef309d80510a5a49d1eb933747fc9e /src/couchdb | |
parent | d107466d3962a989b9371b8194d35a258886616e (diff) |
Merged revision 997152 from trunk:
Replicator bug fix: make sure a replication fails when there's a stale connection to a remote DB's _changes.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.0.x@997153 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r-- | src/couchdb/couch_rep_changes_feed.erl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/couchdb/couch_rep_changes_feed.erl b/src/couchdb/couch_rep_changes_feed.erl index 958ee82f..a8c77b18 100644 --- a/src/couchdb/couch_rep_changes_feed.erl +++ b/src/couchdb/couch_rep_changes_feed.erl @@ -210,9 +210,16 @@ handle_info({'EXIT', From, Reason}, #state{changes_loop=From} = State) -> handle_info({'EXIT', _From, normal}, State) -> {noreply, State}; -handle_info(Msg, State) -> - ?LOG_DEBUG("unexpected message at changes_feed ~p", [Msg]), - {noreply, State}. +handle_info(Msg, #state{init_args = InitArgs} = State) -> + case Msg of + changes_timeout -> + [_, #http_db{url = Url} | _] = InitArgs, + ?LOG_ERROR("changes loop timeout, no data received from ~s", + [couch_util:url_strip_password(Url)]); + _ -> + ?LOG_ERROR("changes loop received unexpected message ~p", [Msg]) + end, + {stop, Msg, State}. terminate(_Reason, State) -> #state{ @@ -377,7 +384,7 @@ maybe_stream_next(#state{reqid=nil}) -> ok; maybe_stream_next(#state{complete=false, count=N} = S) when N < ?BUFFER_SIZE -> timer:cancel(get(timeout)), - {ok, Timeout} = timer:exit_after(31000, changes_timeout), + {ok, Timeout} = timer:send_after(31000, changes_timeout), put(timeout, Timeout), ibrowse:stream_next(S#state.reqid); maybe_stream_next(_) -> |