Permalink
Browse files

added commands_queued() during transaction

  • Loading branch information...
1 parent 7bac7e4 commit b49418c5530b28737ca920b136cc2509ce1c65de @slact committed Jan 12, 2011
Showing with 6 additions and 0 deletions.
  1. +3 −0 src/redis.lua
  2. +3 −0 test/test_client.lua
View
@@ -410,6 +410,9 @@ do
transaction_client.multi = function(...)
coroutine.yield()
end
+ transaction_client.commands_queued = function()
+ return #queued_parsers
+ end
assert(coroutine.resume(coro, transaction_client))
@@ -2170,10 +2170,13 @@ context("Redis commands", function()
local val = t:get('foobar')
t:multi()
assert_response_queued(t:set('discardable', 'bar'))
+ assert_equal(t:commands_queued(), 1)
assert_true(t:discard())
assert_response_queued(t:ping())
+ assert_equal(t:commands_queued(), 1)
assert_response_queued(t:echo('hello'))
assert_response_queued(t:echo('redis'))
+ assert_equal(t:commands_queued(), 3)
if n>0 then
n = n-1
redis2:set("foobarr", n)

0 comments on commit b49418c

Please sign in to comment.