lib/redic/client.rb in redic-1.5.1 vs lib/redic/client.rb in redic-1.5.2

- old
+ new

@@ -29,18 +29,17 @@ def write(command) @connection.write(command) end def connect - establish_connection unless connected? - @semaphore.synchronize do + establish_connection unless connected? yield + rescue Errno::ECONNRESET + @connection = false + retry end - rescue Errno::ECONNRESET - @connection = false - retry end def connected? @connection && @connection.connected? end @@ -52,11 +51,11 @@ end end def quit if connected? - assert_ok(call("QUIT")) + assert_ok(@semaphore.synchronize { call("QUIT") }) disconnect! true else false @@ -81,13 +80,11 @@ end end end def call(*args) - @semaphore.synchronize do - write(args) - read - end + write(args) + read end def assert(value, error) raise error unless value end