Skip to content

Commit

Permalink
Reimplemented BigCouch supporting changes for sequence as an Array re…
Browse files Browse the repository at this point in the history
…turnvalue and wanting the since= parameter as the second array value.
  • Loading branch information
voortwis committed Nov 6, 2014
1 parent 5e2a8ba commit 86ddfa3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ Feed.prototype.confirm = function confirm_feed() {
}

// If the next change would come after the current update_seq, just fake a catchup event now.
if(self.original_db_seq == self.since) {
//Fixed for Array type sequence of BigCouch (compare the second item)
if ((self.original_db_seq[0] || self.original_db_seq) == (self.since[0] || self.since)) {
self.caught_up = true
self.emit('catchup', db.update_seq)
}
Expand Down Expand Up @@ -200,6 +201,11 @@ Feed.prototype.query = function query_feed() {
if(query_params.feed == 'longpoll' && (!query_params.limit || query_params.limit > poll_size))
query_params.limit = poll_size;

//Fix for Array type sequence of BigCouch
if (query_params.since[1]) {
query_params.since = query_params.since[1];
}

var feed_url = self.db + (self.is_db_updates ? '' : '/_changes') + '?' + querystring.stringify(query_params);

self.headers.accept = self.headers.accept || 'application/json';
Expand Down Expand Up @@ -610,7 +616,8 @@ Feed.prototype.check_for_catchup = function check_for_catchup(seq) {
return
if(self.caught_up)
return
if(seq < self.original_db_seq)
//Fix for Array type sequence of BigCouch
if ((seq[0] || seq) < (self.original_db_seq[0] || self.original_db_seq))
return

self.caught_up = true
Expand Down

0 comments on commit 86ddfa3

Please sign in to comment.