summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-09-02 12:17:44 +0200
committerAzul <azul@leap.se>2012-09-02 12:17:44 +0200
commitce01ff5ba54eda2748c52cac25004af551c7efc2 (patch)
treeaabbe1004017ff3823e240b34f0a1a5d8bdf0e46
parentf908b99e42e07914f18c1c6ec2001926d7796d55 (diff)
use right db and only track new changes
-rw-r--r--test.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/test.rb b/test.rb
index 1363a8c..477be2e 100644
--- a/test.rb
+++ b/test.rb
@@ -5,11 +5,16 @@ require "yajl/http_stream"
def main
url = "http://localhost:5984/"
- db = "leap_certs"
+ db = "salticidae_certs"
feed_type = "continuous"
since = "0"
queue = "changes"
-
+
+ # descending = true for last changes first. limit = 1
+ Yajl::HttpStream.get("#{url}#{db}/_changes?limit=1&descending=true", :symbolize_keys => true) do |hash|
+ since = hash[:last_seq]
+ end
+
Yajl::HttpStream.get("#{url}#{db}/_changes?feed=#{feed_type}&since=#{since}", :symbolize_keys => true) do |hash|
if hash[:id]
p hash