From 442598e58cab82f0e0cfe20767e03b4d6b9fdbc3 Mon Sep 17 00:00:00 2001 From: Maksim Chartkou Date: Tue, 24 May 2016 21:32:10 +0300 Subject: [PATCH] fix: for _db_updates heartbeat parameter have a bit difference http://docs.couchdb.org/en/1.6.1/api/database/changes.html http://docs.couchdb.org/en/1.6.1/api/server/common.html#db-updates --- lib/feed.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/feed.js b/lib/feed.js index 2b555dd..46a13f9 100644 --- a/lib/feed.js +++ b/lib/feed.js @@ -44,7 +44,8 @@ function Feed (opts) { opts = opts || {} self.feed = 'continuous'; - self.heartbeat = opts.heartbeat || DEFAULT_HEARTBEAT; + self.heartbeat = opts.timeout || opts.heartbeat || DEFAULT_HEARTBEAT; + //self.timeout = opts.timeout || opts.heartbeat || DEFAULT_HEARTBEAT; self.max_retry_seconds = opts.max_retry_seconds || DEFAULT_MAX_RETRY_SECONDS; self.inactivity_ms = null; self.initial_retry_delay = opts.initial_retry_delay || INITIAL_RETRY_DELAY; @@ -188,7 +189,15 @@ Feed.prototype.query = function query_feed() { FEED_PARAMETERS.forEach(function(key) { if(key in self) query_params[key] = self[key]; - }) + }); + + // for _db_updates parameters have a bit difference + // http://docs.couchdb.org/en/1.6.1/api/database/changes.html + // http://docs.couchdb.org/en/1.6.1/api/server/common.html#db-updates + if(self.is_db_updates){ + query_params.timeout = query_params.heartbeat; + query_params.heartbeat = true; + } if(typeof query_params.filter !== 'string') delete query_params.filter;