keen 0.0.5 → 0.0.52

Sign up to get free protection for your applications and to get access to all the features.
data/examples.rb CHANGED
@@ -6,7 +6,7 @@ project_id = 'asdfasldkfjalsdkfalskdfj'
6
6
  auth_token = 'asldfjklj325tkl32jaskdlfjaf'
7
7
 
8
8
  # First you must setup the client:
9
- keen = Keen::Client.new(project_id, auth_token)
9
+ keen = Keen::Client.new(project_id, auth_token, :storage_mode => :redis)
10
10
 
11
11
  # Then, you can use that client to send events.
12
12
 
@@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base
18
18
  auth_token = "a5d4eaf432914823a94ecd7e0cb547b9"
19
19
 
20
20
  # First you must setup the client:
21
- keen = Keen::Client.new(project_id, auth_token)
21
+ keen = Keen::Client.new(project_id, auth_token, :storage_mode => :redis)
22
22
 
23
23
  # Log the event with Keen:
24
24
  keen.add_event("pageviews", {
data/keen.gemspec CHANGED
@@ -25,7 +25,9 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency('json', '>= 1.6.5')
26
26
  s.add_dependency('fakeweb', '>= 1.3.0')
27
27
  s.add_dependency('rspec', '>= 2.9.0')
28
- s.add_dependency('system_timer', '>= 1.2.4')
28
+ if RUBY_VERSION < "1.9"
29
+ s.add_dependency('system_timer', '>= 1.2.4')
30
+ end
29
31
  s.add_dependency('redis', '>= 2.2.2')
30
32
 
31
33
  # took these from Twilio library:
@@ -39,6 +39,10 @@ module Keen
39
39
  def initialize
40
40
  @redis = Redis.new
41
41
  end
42
+
43
+ def redis=(connection)
44
+ @redis = connection
45
+ end
42
46
 
43
47
  def count_active_queue
44
48
  @redis.llen active_queue_key
@@ -31,7 +31,7 @@ module Keen
31
31
 
32
32
  batch_size = Keen::Async::BATCH_SIZE
33
33
 
34
- num_batches = queue_length / batch_size
34
+ num_batches = 1 + queue_length / batch_size
35
35
 
36
36
  num_batches.times do
37
37
  collated = @handler.get_collated_jobs(batch_size)
@@ -39,6 +39,8 @@ module Keen
39
39
  send_batch(project_id, batch)
40
40
  end
41
41
  end
42
+
43
+ puts "Worker sent #{num_batches} batches of #{batch_size} events per batch."
42
44
  end
43
45
 
44
46
  def send_batch(project_id, batch)
data/lib/keen/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Keen
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.52"
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: 21
4
+ hash: 119
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 52
10
+ version: 0.0.52
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kyle Wild
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-19 00:00:00 -05:00
18
+ date: 2012-06-11 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency