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 2011/11/28 13:54:26 UTC

[2/3] git commit: Make couch_changes:reset_heartbeat/0 a no-op

Make couch_changes:reset_heartbeat/0 a no-op

If no heartbeat option was given, the couch_changes heartbeat
function should really be a no-op, that is, to not set the
last_changes_heartbeat to the current time, otherwise the
default TimeoutFun (when no heartbeat option is given) might
be called which causes the changes feed to stop immediately
before folding the whole seq tree.

This relates to COUCHDB-1289.


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

Branch: refs/heads/master
Commit: d159dba5620060dcec00c9a877c00a699d6087bc
Parents: e18e32b
Author: Filipe David Borba Manana <fd...@apache.org>
Authored: Mon Nov 28 12:30:50 2011 +0000
Committer: Filipe David Borba Manana <fd...@apache.org>
Committed: Mon Nov 28 12:38:39 2011 +0000

----------------------------------------------------------------------
 src/couchdb/couch_changes.erl |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/d159dba5/src/couchdb/couch_changes.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_changes.erl b/src/couchdb/couch_changes.erl
index f124567..72ee346 100644
--- a/src/couchdb/couch_changes.erl
+++ b/src/couchdb/couch_changes.erl
@@ -531,7 +531,12 @@ get_rest_db_updated(UserAcc) ->
     end.
 
 reset_heartbeat() ->
-    put(last_changes_heartbeat,now()).
+    case get(last_changes_heartbeat) of
+    undefined ->
+        ok;
+    _ ->
+        put(last_changes_heartbeat, now())
+    end.
 
 maybe_heartbeat(Timeout, TimeoutFun, Acc) ->
     Before = get(last_changes_heartbeat),