sensu-redis 2.3.0 → 2.4.0

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: 130f1d035399f05c74f3540743bfea9496d416ad
4
- data.tar.gz: 3f1f33e4524d9691f8ed0924c66159d16cd7cd0b
3
+ metadata.gz: 5939b7177d92baf80d426264a3243a6d0920d9dd
4
+ data.tar.gz: eee5530168c09cadb6eb766a62e4056e112c77b5
5
5
  SHA512:
6
- metadata.gz: 76f796f5c02eb17b2b5ec6443d6f9352909ae05e974a7db64d2e59af679d27466bf1d1e03c7d11c68c755b56e5860ec5dd9adf8f889ab68c973cc9898be66dea
7
- data.tar.gz: 9cb0310c6bb4efd8935411bc97d88fb36178179f85e6ba7beac56864e935180d9618582a690ebeb56f7c5645b4e94475559b25650646c010a733d8e3e858b7a4
6
+ metadata.gz: 1105045f20f729b050ea48fe32cb89162debddd8e07243a8bd7ea9a1d788c5c73e4ddb7fbcb33c8fcf21c7d67c71b60f0292b6d0aef4829970c9d37111c9ff37
7
+ data.tar.gz: d1d84791dc6aec961652f85d7064484a20e36662d2378c4ee85f4f11e1019dfdded03c2f1eef97e937cb0efa3a9feaa6d29a244c809c3c981a7cdee3a5fc58a4
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,9 +1,12 @@
1
1
  require "sensu/redis/client"
2
+ require "sensu/redis/utilities"
2
3
  require "eventmachine"
3
4
 
4
5
  module Sensu
5
6
  module Redis
6
7
  class Sentinel
8
+ include Utilities
9
+
7
10
  attr_accessor :logger
8
11
 
9
12
  # Initialize the Sentinel connections. The default Redis master
@@ -15,26 +18,35 @@ module Sensu
15
18
  # connection settings.
16
19
  def initialize(options={})
17
20
  @master = options[:master_group] || options[:master] || "mymaster"
18
- @sentinels = connect_to_sentinels(options[:sentinels])
21
+ @sentinels = []
22
+ connect_to_sentinels(options[:sentinels])
19
23
  end
20
24
 
21
- # Connect to a Sentinel instance.
25
+ # Connect to a Sentinel instance and add the connection to
26
+ # `@sentinels` to be called upon. This method defaults the
27
+ # Sentinel host and port if either have not been set.
22
28
  #
23
29
  # @param options [Hash] containing the host and port.
24
- # @return [Object] Sentinel connection.
25
30
  def connect_to_sentinel(options={})
26
31
  options[:host] ||= "127.0.0.1"
27
32
  options[:port] ||= 26379
28
- EM.connect(options[:host], options[:port].to_i, Client, options)
33
+ resolve_host(options[:host]) do |ip_address|
34
+ if ip_address.nil?
35
+ EM::Timer.new(1) do
36
+ connect_to_sentinel(options)
37
+ end
38
+ else
39
+ @sentinels << EM.connect(ip_address, options[:port].to_i, Client, options)
40
+ end
41
+ end
29
42
  end
30
43
 
31
- # Connect to all Sentinel instances. This method defaults the
32
- # Sentinel host and port if either have not been set.
44
+ # Connect to all Sentinel instances. The Sentinel instance
45
+ # connections will be added to `@sentinels`.
33
46
  #
34
47
  # @param sentinels [Array]
35
- # @return [Array] of Sentinel connection objects.
36
48
  def connect_to_sentinels(sentinels)
37
- sentinels.map do |options|
49
+ sentinels.each do |options|
38
50
  connect_to_sentinel(options)
39
51
  end
40
52
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-redis"
5
- spec.version = "2.3.0"
5
+ spec.version = "2.4.0"
6
6
  spec.authors = ["Sean Porter"]
7
7
  spec.email = ["portertech@gmail.com", "engineering@sensu.io"]
8
8
  spec.summary = "The Sensu Redis client library"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -30,7 +30,7 @@ cert_chain:
30
30
  jOeGyhtQa9j4FFmsEJDg59f5v/3hECXsa3Xuml3foaFHzX3Ya/YIyd2YFxvkFKIu
31
31
  GVbe7A3YdxzdkH2Es/Ym9twdxXaIDdXzj8sWhw==
32
32
  -----END CERTIFICATE-----
33
- date: 2018-03-09 00:00:00.000000000 Z
33
+ date: 2018-12-07 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: eventmachine
metadata.gz.sig CHANGED
Binary file