em-hiredis-sentinel 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3820b569ecfeb024ad4b2954ce00f0757294ffdc
4
- data.tar.gz: 77c4c1ff4d14a390d711f230d6d9a5bf92a8272c
3
+ metadata.gz: 12da4ece90b62751bab33970653fc6646597c5ab
4
+ data.tar.gz: 5df06626c12576441d7ec5fe3a18465f5dd5d44c
5
5
  SHA512:
6
- metadata.gz: 5bd602377b6a0e0cd3a3d8a0e425f098fd2825319fcff40179d457cc867d0cf5833b90ac2dac84e555076ce90c48f2250341d336547ac9e2905db6d18b3ae788
7
- data.tar.gz: 1c3f5280f5991fea7c4957fc33f822d4768b0e4c2c8126ebf36ab277a9294780e9c37833b5edd4c5d64bdc94fd7f3dd5ef152221ff4e1e5c6735cb5850b944d9
6
+ metadata.gz: 5ecdcce6e55f24b4a0b31346dd5512c5009fd3432fb31efd459b3c23fb8a980429110dda986ad8f5d05e29842dd0a5f34f22e1ce415dac090c1dd9b83dade89a
7
+ data.tar.gz: 38223becb9dfc216e004da3009fc46a6525f89253349c2ed2da9da06023392637489debd842172b45f650087755d13e6b8d6ca59d8901ffdf65ea137a24842c0
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Em::Hiredis::Sentinel
2
2
 
3
- Sentinel Support for em-hiredis. Currently this gem does not fully monkey patch the em-hiredis gem in place.
3
+ Sentinel Support for em-hiredis.
4
4
 
5
5
  ## Installation
6
6
 
@@ -4,8 +4,7 @@ module EventMachine::Hiredis
4
4
  attr_reader :sentinel_options
5
5
 
6
6
  def initialize_with_sentinel(host = 'localhost', port = 6379, password = nil, db = nil, sentinel_options={})
7
- #@options = sentinel_options.dup
8
- puts "SentinelOptions: #{sentinel_options}"
7
+
9
8
  initialize_without_sentinel(host,port,password,db)
10
9
  if sentinel_options.nil? || sentinel_options.empty?
11
10
  return
@@ -34,15 +33,11 @@ module EventMachine::Hiredis
34
33
  pubsub.punsubscribe('*')
35
34
  pubsub.psubscribe('*')
36
35
  pubsub.on(:pmessage) { |pattern, channel, message|
37
- puts "Channel:#{channel}"
38
- puts "Message:#{message}"
39
36
  next if channel != '+switch-master'
40
37
 
41
38
  master_name, old_host, old_port, new_host, new_port = message.split(" ")
42
39
 
43
40
  next if master_name != @master_name
44
-
45
- #@options.merge!(host: new_host, port: new_port.to_i)
46
41
  EM::Hiredis.logger.info("Failover: #{old_host}:#{old_port} => #{new_host}:#{new_port}")
47
42
  close_connection
48
43
  @host, @port = new_host,new_port.to_i
@@ -55,18 +50,16 @@ module EventMachine::Hiredis
55
50
  sentinel_options = @sentinels_options.shift
56
51
  @sentinels_options.push sentinel_options
57
52
 
58
- puts "Trying next sentinel: #{sentinel_options[:host]}:#{sentinel_options[:port]}" #if @logger && @logger.debug?
53
+ EM::Hiredis.logger.info("Trying next sentinel: #{sentinel_options[:host]}:#{sentinel_options[:port]}")
59
54
  @current_sentinel.close_connection
60
55
  @current_sentinel.configure("redis://#{sentinel_options[:host]}:#{sentinel_options[:port]}")
61
56
  @current_sentinel.reconnect_connection
62
57
  unless @switching_sentinels
63
58
  @switching_sentinels = true
64
59
  @sentinel_timer = EM.add_periodic_timer(1) {
65
- puts 'Trying New Sentinel Connection'
66
60
  if @current_sentinel.connected?
67
61
  @switching_sentinels = false
68
62
  @sentinel_timer.cancel
69
- #watch_sentinel
70
63
  else
71
64
  try_next_sentinel
72
65
  end
@@ -81,9 +74,6 @@ module EventMachine::Hiredis
81
74
 
82
75
  if master_host && master_port
83
76
 
84
- # An ip:port pair
85
- #@options.merge!(:host => master_host, :port => master_port.to_i, :password => @master_password)
86
- #close_connection
87
77
  @host, @port = master_host,master_port.to_i
88
78
  reconnect_connection
89
79
  refresh_sentinels_list
@@ -2,7 +2,6 @@ module EventMachine::Hiredis
2
2
  class PubsubClient < BaseClient
3
3
  class_eval {
4
4
  def initialize(host='localhost', port='6379', password=nil, db=nil, sentinel_options={})
5
- puts "Initializing with sentinel: #{sentinel_options}"
6
5
  @subs, @psubs = [], []
7
6
  @pubsub_defs = Hash.new { |h,k| h[k] = [] }
8
7
  super
@@ -3,7 +3,7 @@ require 'eventmachine'
3
3
  module EventMachine
4
4
  module Hiredis
5
5
  module Sentinel
6
- VERSION = '0.1.2'
6
+ VERSION = '0.1.3'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-hiredis-sentinel
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
  - Justin Schneck