Skip to content

Commit 82d81b6

Browse files
authored
Avoid data corruption in #queue.
Potential fix for #878.
1 parent 6b894f8 commit 82d81b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/redis.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ def call(*command)
100100
# See http://redis.io/topics/pipelining for more details.
101101
#
102102
def queue(*command)
103-
@queue[Thread.current.object_id] << command
103+
synchronize do
104+
@queue[Thread.current.object_id] << command
105+
end
104106
end
105107

106108
# Sends all commands in the queue.

0 commit comments

Comments
 (0)