summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_rep_changes_feed.erl
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2010-02-28 02:41:05 +0000
committerJan Lehnardt <jan@apache.org>2010-02-28 02:41:05 +0000
commit5a9f96cf2646a0c9db468cd7876e75cdb9fda742 (patch)
treeaca872035e7c6c5191c026dee592e1d5104432ac /src/couchdb/couch_rep_changes_feed.erl
parent64572be3b4b5e186013213bc2adf883d26d8f729 (diff)
Apply fixes for COUCHDB-597 patch.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@917096 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_rep_changes_feed.erl')
-rw-r--r--src/couchdb/couch_rep_changes_feed.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/couchdb/couch_rep_changes_feed.erl b/src/couchdb/couch_rep_changes_feed.erl
index 7c308800..343b445c 100644
--- a/src/couchdb/couch_rep_changes_feed.erl
+++ b/src/couchdb/couch_rep_changes_feed.erl
@@ -40,9 +40,7 @@ start_link(Parent, Source, StartSeq, PostProps) ->
gen_server:start_link(?MODULE, [Parent, Source, StartSeq, PostProps], []).
next(Server) ->
- try gen_server:call(Server, next_changes, 31000)
- catch exit:{timeout, _Reason} -> throw(changes_timeout)
- end.
+ gen_server:call(Server, next_changes, infinity).
stop(Server) ->
gen_server:call(Server, stop).
@@ -128,7 +126,8 @@ init([_Parent, Source, Since, PostProps] = InitArgs) ->
"continuous";
false ->
"normal"
- end
+ end,
+ timeout = infinity
},
ChangesPid = spawn_link(fun() ->
ChangesFeedFun = couch_changes:handle_changes(
@@ -369,9 +368,12 @@ decode_row(Row) ->
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),
+ put(timeout, Timeout),
ibrowse:stream_next(S#state.reqid);
maybe_stream_next(_) ->
- ok.
+ timer:cancel(get(timeout)).
start_http_request(RawUrl) ->
Url = ibrowse_lib:parse_url(RawUrl),