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/b918fcfa Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b918fcfa Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b918fcfa Branch: refs/heads/1.2.x Commit: b918fcfa1b99c97a7399d720a6fedc2c56c98c3d Parents: dc1342d Author: Filipe David Borba Manana <[email protected]> Authored: Mon Nov 28 12:30:50 2011 +0000 Committer: Filipe David Borba Manana <[email protected]> Committed: Mon Nov 28 13:01:12 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/b918fcfa/src/couchdb/couch_changes.erl ---------------------------------------------------------------------- diff --git a/src/couchdb/couch_changes.erl b/src/couchdb/couch_changes.erl index b0fdb06..1de24d4 100644 --- a/src/couchdb/couch_changes.erl +++ b/src/couchdb/couch_changes.erl @@ -524,7 +524,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),
