stathat 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd028f6c38be0568aafcb4c61551265bee55a15a
4
- data.tar.gz: 2d769feddbb21b40f2cca5439580d8f41963f028
3
+ metadata.gz: 4f30db6432405ab6b55e2dfc910ec9118cbbc30e
4
+ data.tar.gz: 7958f0d0103b5ec08d022de500236fc95525efdf
5
5
  SHA512:
6
- metadata.gz: a34468e2baa1fdbffc7ff77cf606a2ea17fbaade1958f8961e7574860aa200659a7c15f025eb80d39a5a56d9c01e9d3aaa38644bfeb412431f6521a196579dee
7
- data.tar.gz: 769d70f9fb15b9e83d4114c81b7a5c20ffb655d5243c9c7e4ed7d4e6f42394d4caa54d34d071d004138daca6a5548e77d259774eb78f7b98b3b5fd94189650b3
6
+ metadata.gz: e40080c4d45e90ee6858f1b9d5e2c1b07bc215009b884819281c874e32092feb03f5337379de8d69f041bab7c539b17436a7700d8df10f28b230fe8b6321cb70
7
+ data.tar.gz: 72ef316598460e8cdb2acf0f425809154d7bfe122211de190980ea1ce8d84a246ae2be64577bb17b56b90bb100c9ab38c5b2968ae63425812d5c5b37a1bcd713
@@ -35,6 +35,7 @@ module StatHat
35
35
 
36
36
  def initialize
37
37
  @que = Queue.new
38
+ @runlock = Mutex.new
38
39
  run_pool()
39
40
  end
40
41
 
@@ -74,12 +75,12 @@ module StatHat
74
75
 
75
76
  private
76
77
  def run_pool
77
- @running = true
78
+ @runlock.synchronize { @running = true }
78
79
  @pool = []
79
80
  5.times do |i|
80
81
  @pool[i] = Thread.new do
81
82
  puts "thread #{i} started"
82
- while @running do
83
+ while true do
83
84
  point = @que.pop
84
85
  # XXX check for error?
85
86
  begin
@@ -91,6 +92,9 @@ module StatHat
91
92
  rescue
92
93
  pp $!
93
94
  end
95
+ @runlock.synchronize {
96
+ break unless @running
97
+ }
94
98
  end
95
99
  puts "reporter thread #{i} finished"
96
100
  end
@@ -98,9 +102,11 @@ module StatHat
98
102
  end
99
103
 
100
104
  def stop_pool()
101
- @running = false
105
+ @runlock.synchronize {
106
+ @running = false
107
+ }
102
108
  @pool.each do |th|
103
- th.join
109
+ th.join if th && th.alive?
104
110
  end
105
111
  end
106
112
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{stathat}
5
- s.version = "0.1.2"
5
+ s.version = "0.1.3"
6
6
  s.authors = ["StatHat"]
7
7
  s.description = %q{Easily post stats to your StatHat account using this gem. Encapsulates full API.}
8
8
  s.email = %q{info@stathat.com}
@@ -10,7 +10,6 @@ class TestStathat < MiniTest::Unit::TestCase
10
10
  assert_equal(resp.status, 200, "status should be 200")
11
11
  end
12
12
  sleep(1)
13
- puts "finished test_ez_val"
14
13
  end
15
14
 
16
15
  def test_ez_count
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stathat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - StatHat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-18 00:00:00.000000000 Z
11
+ date: 2013-03-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Easily post stats to your StatHat account using this gem. Encapsulates
14
14
  full API.