Permalink
Browse files

Merge pull request #22 from kanongil/non-integer-seq-support

allow non-integer sequence id's
  • Loading branch information...
2 parents 76cb612 + 321537e commit 65fd09e34182c1e9a557d346d81c689d2bfade38 @jhs jhs committed Jan 14, 2013
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/feed.js
View
@@ -136,7 +136,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
}
@@ -513,12 +519,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)
}

0 comments on commit 65fd09e

Please sign in to comment.