From 4355f1d6c0255d639e9afb632a6627f8be9cb49b Mon Sep 17 00:00:00 2001 From: Earl Levine Date: Tue, 9 Sep 2014 14:23:19 -0700 Subject: [PATCH] Clear queue in commit, so we don't repeat old queue items. Allow safely calling commit before queue. --- lib/redic/pool.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/redic/pool.rb b/lib/redic/pool.rb index 452c3db..ac0d1f8 100644 --- a/lib/redic/pool.rb +++ b/lib/redic/pool.rb @@ -27,9 +27,10 @@ def queue(*args) def commit @pool.with do |client| - Thread.current[@id].each do |args| + (Thread.current[@id] || []).each do |args| client.queue(*args) end + Thread.current[@id] = [] # clear the thread queue client.commit end