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 2012/01/23 00:43:13 UTC
[28/50] git commit: Add heartbeat parameter to all _changes requests
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/a2d57c8b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a2d57c8b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a2d57c8b
Branch: refs/heads/COUCHDB-1342
Commit: a2d57c8bb34f4621fed00f4e65191a1531bc3110
Parents: 975ea08
Author: Filipe David Borba Manana <fd...@apache.org>
Authored: Sat Jan 7 13:44:45 2012 +0000
Committer: Filipe David Borba Manana <fd...@apache.org>
Committed: Sat Jan 7 13:44:45 2012 +0000
----------------------------------------------------------------------
.../src/couch_replicator_api_wrap.erl | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2d57c8b/src/couch_replicator/src/couch_replicator_api_wrap.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
index a29fe94..d287fcb 100644
--- a/src/couch_replicator/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl
@@ -306,13 +306,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