keen 0.0.52 → 0.0.53
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/keen_send +5 -1
- data/lib/keen/async/job.rb +5 -1
- data/lib/keen/async/storage/redis_handler.rb +13 -4
- data/lib/keen/async/worker.rb +1 -1
- data/lib/keen/version.rb +1 -1
- metadata +3 -3
data/bin/keen_send
CHANGED
data/lib/keen/async/job.rb
CHANGED
@@ -31,7 +31,7 @@ module Keen
|
|
31
31
|
|
32
32
|
# define some key lists:
|
33
33
|
required_keys = [:project_id, :auth_token, :collection_name, :event_body]
|
34
|
-
optional_keys = []
|
34
|
+
optional_keys = [:keen_client_version]
|
35
35
|
all_keys = required_keys + optional_keys
|
36
36
|
|
37
37
|
|
@@ -54,6 +54,10 @@ module Keen
|
|
54
54
|
self.instance_variable_set("@#{key}", value)
|
55
55
|
end
|
56
56
|
|
57
|
+
unless definition.has_key? :keen_client_version
|
58
|
+
definition[:keen_client_version] = Keen::VERSION
|
59
|
+
end
|
60
|
+
|
57
61
|
@definition = definition
|
58
62
|
|
59
63
|
|
@@ -12,7 +12,7 @@ module Keen
|
|
12
12
|
# ----
|
13
13
|
|
14
14
|
def global_key_prefix
|
15
|
-
"
|
15
|
+
"keen"
|
16
16
|
end
|
17
17
|
|
18
18
|
def active_queue_key
|
@@ -25,7 +25,9 @@ module Keen
|
|
25
25
|
|
26
26
|
def add_to_active_queue(value)
|
27
27
|
@redis.lpush active_queue_key, value
|
28
|
-
|
28
|
+
if @logging
|
29
|
+
puts "added #{value} to active queue; length is now #{@redis.llen active_queue_key}"
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
def record_job(job)
|
@@ -36,8 +38,9 @@ module Keen
|
|
36
38
|
# TODO consume the failed_queue and do something with it (loggly? retry? flat file?)
|
37
39
|
end
|
38
40
|
|
39
|
-
def initialize
|
41
|
+
def initialize(logging = false)
|
40
42
|
@redis = Redis.new
|
43
|
+
@logging = logging
|
41
44
|
end
|
42
45
|
|
43
46
|
def redis=(connection)
|
@@ -105,9 +108,15 @@ module Keen
|
|
105
108
|
|
106
109
|
jobs = []
|
107
110
|
|
111
|
+
#puts "doing the job #{how_many} times"
|
112
|
+
|
108
113
|
how_many.times do
|
109
114
|
this = @redis.lpop key
|
110
|
-
|
115
|
+
if this
|
116
|
+
jobs.push JSON.parse this
|
117
|
+
else
|
118
|
+
#puts "couldn't process value #{this}"
|
119
|
+
end
|
111
120
|
end
|
112
121
|
|
113
122
|
collate_jobs(jobs)
|
data/lib/keen/async/worker.rb
CHANGED
data/lib/keen/version.rb
CHANGED
metadata
CHANGED