zk 0.8.3 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/z_k/pool.rb CHANGED
@@ -59,8 +59,10 @@ module ZK
59
59
 
60
60
  @pool.clear
61
61
 
62
- while cnx = @connections.shift
63
- cnx.close!
62
+ until @connections.empty?
63
+ if cnx = @connections.shift
64
+ cnx.close!
65
+ end
64
66
  end
65
67
 
66
68
  @state = :closed
@@ -105,7 +107,7 @@ module ZK
105
107
  end
106
108
 
107
109
  def size #:nodoc:
108
- @connection.synchronize { @pool.size }
110
+ @mutex.synchronize { @pool.size }
109
111
  end
110
112
 
111
113
  def pool_state #:nodoc:
@@ -191,6 +193,10 @@ module ZK
191
193
 
192
194
  if @pool.length > 0
193
195
  cnx = @pool.shift
196
+
197
+ # XXX(slyphon): not really sure how this case happens, but protect against it as we're
198
+ # seeing an issue in production
199
+ next if cnx.nil?
194
200
 
195
201
  # if the connection isn't connected, then set up an on_connection
196
202
  # handler and try the next one in the pool
data/lib/z_k/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ZK
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.4"
3
3
  end
@@ -44,7 +44,7 @@ describe ZK::Election do
44
44
  # wait for us to signal
45
45
  queue.pop
46
46
 
47
- $stderr.puts "obama on_winning_election entered"
47
+ # $stderr.puts "obama on_winning_election entered"
48
48
  @obama_won = true
49
49
  end
50
50
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 3
10
- version: 0.8.3
9
+ - 4
10
+ version: 0.8.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan D. Simms
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-06-27 00:00:00 +00:00
19
+ date: 2011-07-08 00:00:00 +00:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency