From 82d81b6b3b9d689d8a381b7aa9d4269324776e54 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 28 Oct 2019 13:31:26 +1300 Subject: [PATCH] Avoid data corruption in `#queue`. Potential fix for #878. --- lib/redis.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/redis.rb b/lib/redis.rb index afd9d628b..563415c38 100644 --- a/lib/redis.rb +++ b/lib/redis.rb @@ -100,7 +100,9 @@ def call(*command) # See http://redis.io/topics/pipelining for more details. # def queue(*command) - @queue[Thread.current.object_id] << command + synchronize do + @queue[Thread.current.object_id] << command + end end # Sends all commands in the queue.