Skip to content

Commit 048d2d7

Browse files
committedApr 25, 2011
SHUTDOWN never receives a reply
1 parent 6276984 commit 048d2d7

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
 

‎lib/redis.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ def quit
960960
# Synchronously save the dataset to disk and then shut down the server.
961961
def shutdown
962962
synchronize do
963-
@client.call [:shutdown]
963+
@client.call_without_reply [:shutdown]
964964
end
965965
end
966966

‎lib/redis/client.rb

+7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ def call(*args)
4848
reply
4949
end
5050

51+
# Assume that this method is called with a single array argument. No
52+
# backwards compat here, since it was introduced in 2.2.2.
53+
def call_without_reply(command)
54+
process([command])
55+
nil
56+
end
57+
5158
# Starting with 2.2.1, assume that this method is called with a single
5259
# array argument. Check its size for backwards compat.
5360
def call_loop(*args)

‎test/connection_handling_test.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
redis_mock(:shutdown => lambda { "+SHUTDOWN" }) do
4848
redis = Redis.new(OPTIONS.merge(:port => 6380))
4949

50-
assert "SHUTDOWN" == redis.shutdown
50+
# SHUTDOWN does not reply: test that it does not raise here.
51+
assert nil == redis.shutdown
5152
end
5253
end
5354

0 commit comments

Comments
 (0)