haproxystats 0.0.5 → 0.0.6

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.
@@ -27,11 +27,14 @@ class HAProxySocket
27
27
  sock.close
28
28
  return out
29
29
  end
30
- out = first_char + sock.read
30
+ if first_char
31
+ out = first_char + sock.read
32
+ end
31
33
  sock.close
32
34
  out
33
35
  rescue Errno::EPIPE
34
- if try_again
36
+ if try_again
37
+ sleep 0.2
35
38
  sock.close
36
39
  run(command, try_again=false)
37
40
  else
@@ -15,6 +15,8 @@ class HAProxyStats < HAProxySocket
15
15
  # and put into @stats[service][server/aggregate]
16
16
  def retrieve(all = false)
17
17
  # run 'show stat' on the socket and iterate output
18
+ stats = run('show stat')
19
+ unless stats.respond_to?('each') then return nil end
18
20
  run('show stat').each do |line|
19
21
  if not defined? @headers
20
22
  # First row of CSV output is our headers
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haproxystats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: