couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rand...@apache.org
Subject git commit: Add heartbeat parameter to all _changes requests
Date Sat, 07 Jan 2012 20:55:54 GMT
Updated Branches:
  refs/heads/1.2.x 3587e084e -> 08d8f89cc


Add heartbeat parameter to all _changes requests

Even non-continuous _changes requests, particularly filtered
ones, can cause long periods of inactivity.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/08d8f89c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/08d8f89c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/08d8f89c

Branch: refs/heads/1.2.x
Commit: 08d8f89cc07920b89b01145268a5b3453837fa82
Parents: 3587e08
Author: Filipe David Borba Manana <fdmanana@apache.org>
Authored: Sat Jan 7 13:44:45 2012 +0000
Committer: Randall Leeds <randall@apache.org>
Committed: Sat Jan 7 12:54:02 2012 -0800

----------------------------------------------------------------------
 src/couchdb/couch_api_wrap.erl |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/08d8f89c/src/couchdb/couch_api_wrap.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_api_wrap.erl b/src/couchdb/couch_api_wrap.erl
index 75436ff..0607d50 100644
--- a/src/couchdb/couch_api_wrap.erl
+++ b/src/couchdb/couch_api_wrap.erl
@@ -308,13 +308,15 @@ update_docs(Db, DocList, Options, UpdateType) ->
 
 changes_since(#httpdb{headers = Headers1} = HttpDb, Style, StartSeq,
     UserFun, Options) ->
+    HeartBeat = erlang:max(1000, HttpDb#httpdb.timeout div 3),
     BaseQArgs = case get_value(continuous, Options, false) of
     false ->
         [{"feed", "normal"}];
     true ->
-        [{"feed", "continuous"}, {"heartbeat", "10000"}]
+        [{"feed", "continuous"}]
     end ++ [
-        {"style", atom_to_list(Style)}, {"since", couch_util:to_list(StartSeq)}
+        {"style", atom_to_list(Style)}, {"since", couch_util:to_list(StartSeq)},
+        {"heartbeat", integer_to_list(HeartBeat)}
     ],
     DocIds = get_value(doc_ids, Options),
     {QArgs, Method, Body, Headers} = case DocIds of


Mime
View raw message