You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2010/09/15 01:54:22 UTC
svn commit: r997152 - /couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl
Author: fdmanana
Date: Tue Sep 14 23:54:21 2010
New Revision: 997152
URL: http://svn.apache.org/viewvc?rev=997152&view=rev
Log:
Replicator bug fix: make sure a replication fails when there's a stale connection to a remote DB's _changes.
Modified:
couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl
Modified: couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl?rev=997152&r1=997151&r2=997152&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl Tue Sep 14 23:54:21 2010
@@ -210,9 +210,16 @@ handle_info({'EXIT', From, Reason}, #sta
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(_) ->