keen 0.0.52 → 0.0.53

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,4 +44,8 @@ end
44
44
 
45
45
  storage_handler = Keen::Client.create_new_storage_handler(options[:storage_mode])
46
46
  worker = Keen::Async::Worker.new(storage_handler)
47
- puts worker.process_queue
47
+ results = worker.process_queue
48
+
49
+
50
+ puts results
51
+
@@ -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
- "keen_415" + Keen::VERSION
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
- puts "added #{value} to active queue; length is now #{@redis.llen active_queue_key}"
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
- jobs.push JSON.parse this
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)
@@ -40,7 +40,7 @@ module Keen
40
40
  end
41
41
  end
42
42
 
43
- puts "Worker sent #{num_batches} batches of #{batch_size} events per batch."
43
+ return "Worker sent #{num_batches} batches of #{batch_size} events per batch."
44
44
  end
45
45
 
46
46
  def send_batch(project_id, batch)
@@ -1,3 +1,3 @@
1
1
  module Keen
2
- VERSION = "0.0.52"
2
+ VERSION = "0.0.53"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 119
4
+ hash: 117
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 52
10
- version: 0.0.52
9
+ - 53
10
+ version: 0.0.53
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kyle Wild