Permalink
Browse files

add sync to perform_with_reconnect

  • Loading branch information...
1 parent 03190f8 commit f1662616fa64988c82ae3a0b46889cd15e81cc7e @ryanlecompte committed Apr 23, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/redis_failover/zk_client.rb
@@ -61,7 +61,8 @@ def on_session_recovered(&block)
class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
def #{zk_method}(*args, &block)
perform_with_reconnect do
- @client.#{zk_method}(*args, &block)
+ client = @lock.synchronize { @client }
+ client.#{zk_method}(*args, &block)
end
end
RUBY
@@ -70,7 +71,7 @@ def #{zk_method}(*args, &block)
private
def handle_expired_session_event(*ignored)
cb = @lock.synchronize { @on_session_expiration }
- cb.call if cb
+ cb.call if cb
end
def handle_connected_event(*ignored)

0 comments on commit f166261

Please sign in to comment.