summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-09-14 23:54:21 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-09-14 23:54:21 +0000
commit4d0abd7052f4aa951e49a3dbcae52e24141b0b4c (patch)
tree7b0fd41a48cfb15a74a3278cb1b800df4bbd9583 /src/couchdb
parenta8d6024454601d1a579e50f10631c5d13b22ef34 (diff)
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/trunk@997152 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_rep_changes_feed.erl15
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(_) ->