summaryrefslogtreecommitdiff
path: root/lib/tapicero
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tapicero')
-rw-r--r--lib/tapicero/couch_changes.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/tapicero/couch_changes.rb b/lib/tapicero/couch_changes.rb
index 35d4b1a..64ae123 100644
--- a/lib/tapicero/couch_changes.rb
+++ b/lib/tapicero/couch_changes.rb
@@ -33,6 +33,7 @@ module Tapicero
Tapicero.logger.debug "Starting at sequence #{since}"
db.changes :feed => :continuous, :since => since, :heartbeat => 1000 do |hash|
callbacks(hash)
+ store_seq(hash["seq"])
end
end
@@ -44,10 +45,9 @@ module Tapicero
def callbacks(hash)
#changed callback
- return deleted(hash) if hash["deleted"]
return unless changes = hash["changes"]
+ return deleted(hash) if hash["deleted"]
created(hash) if changes[0]["rev"].start_with?('1-')
- store_seq(hash["seq"])
#updated callback
end
@@ -57,7 +57,8 @@ module Tapicero
unless File.writable?(seq_filename)
raise StandardError.new("Can't access sequence file")
end
- @since = File.read(seq_filename)
+ @since = File.read(seq_filename).to_i
+ puts @since
rescue Errno::ENOENT => e
Tapicero.logger.warn "No sequence file found. Starting from scratch"
end