Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow non-integer sequence id's

  • Loading branch information...
commit 321537eb3b31a8e9681bdd4e42e607e9297032ab 1 parent d08eac3
@kanongil kanongil authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/feed.js
View
12 lib/feed.js
@@ -135,7 +135,13 @@ Feed.prototype.confirm = function confirm_feed() {
self.since = -1
}
- if(self.since < 0) {
+ if(self.since == -1) {
+ self.log.debug('Query since '+self.since+' will start at ' + db.update_seq)
+ self.since = db.update_seq
+ } else if(self.since < 0) {
+ if(isNaN(db.update_seq))
+ return self.emit('error', new Error('DB requires specific id in "since"'));
+
self.log.debug('Query since '+self.since+' will start at ' + (db.update_seq + self.since + 1))
self.since = db.update_seq + self.since + 1
}
@@ -512,12 +518,12 @@ Feed.prototype.on_change = function on_change(change) {
if(!change.seq)
return self.die(new Error('No seq value in change: ' + lib.JS(change)));
- if(change.seq <= self.since) {
+ if(change.seq == self.since) {
self.log.debug('Bad seq value ' + change.seq + ' since=' + self.since);
return destroy_req(self.pending.request);
}
- if(!self.caught_up && change.seq >= self.original_db_seq) {
+ if(!self.caught_up && change.seq == self.original_db_seq) {
self.caught_up = true
self.emit('catchup', change.seq)
}
Please sign in to comment.
Something went wrong with that request. Please try again.