couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r917097 - in /couchdb/branches/0.11.x/src/couchdb: couch_changes.erl couch_rep_changes_feed.erl
Date Sun, 28 Feb 2010 02:41:24 GMT
Author: jan
Date: Sun Feb 28 02:41:24 2010
New Revision: 917097

URL: http://svn.apache.org/viewvc?rev=917097&view=rev
Log:
Apply fixes for COUCHDB-597 patch.

Modified:
    couchdb/branches/0.11.x/src/couchdb/couch_changes.erl
    couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl

Modified: couchdb/branches/0.11.x/src/couchdb/couch_changes.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_changes.erl?rev=917097&r1=917096&r2=917097&view=diff
==============================================================================
--- couchdb/branches/0.11.x/src/couchdb/couch_changes.erl (original)
+++ couchdb/branches/0.11.x/src/couchdb/couch_changes.erl Sun Feb 28 02:41:24 2010
@@ -117,6 +117,8 @@
         case Timeout of
         undefined ->
             {DefaultTimeout, fun() -> stop end};
+        infinity ->
+            {infinity, fun() -> stop end};
         _ ->
             {lists:min([DefaultTimeout, Timeout]), fun() -> stop end}
         end;

Modified: couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl?rev=917097&r1=917096&r2=917097&view=diff
==============================================================================
--- couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl (original)
+++ couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl Sun Feb 28 02:41:24 2010
@@ -40,9 +40,7 @@
     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 @@
                 "continuous";
             false ->
                 "normal"
-        end
+        end,
+        timeout = infinity
     },
     ChangesPid = spawn_link(fun() ->
         ChangesFeedFun = couch_changes:handle_changes(
@@ -369,9 +368,12 @@
 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),



Mime
View raw message