Skip to content

Commit

Permalink
Use r.client.disconnect instead of r.quit to close connections.
Browse files Browse the repository at this point in the history
We have two requirements when closing connections:

1) Don't call QUIT as it is useless added latency.
2) Don't wait for the GC finalizer to get our process socket closed.

Disconnecting the client object inside the Redis object should do the
trick.
  • Loading branch information
antirez committed Mar 4, 2013
1 parent 4bcccd4 commit d0ee1b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def close_existing_connection
@connections.each{|n,r|
@connections.delete(n)
begin
r.quit
r.client.disconnect
rescue
end
break
Expand All @@ -152,7 +152,7 @@ def get_random_connection
@connections[n[:name]] = r
return r
else
r.quit
r.client.disconnect
end
rescue => e
# Just try with the next node.
Expand Down

0 comments on commit d0ee1b2

Please sign in to comment.