summaryrefslogtreecommitdiff
path: root/queue/zset/add.rb
diff options
context:
space:
mode:
authorJames Lawrie <james@bytemark.co.uk>2015-12-20 09:58:56 +0000
committerJames Lawrie <james@bytemark.co.uk>2015-12-20 09:58:56 +0000
commitddd8335d24b2e59aaf7eec64bbef3d4d95b89733 (patch)
tree7a3ec7556309339e178436c7bb9cbe3d95b7281c /queue/zset/add.rb
parent0b97bce5bac83885dd7843306e2858ab2429c102 (diff)
Fixing test suite as per lodge post
Diffstat (limited to 'queue/zset/add.rb')
-rwxr-xr-xqueue/zset/add.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/queue/zset/add.rb b/queue/zset/add.rb
index 2c778a4..c75bcd6 100755
--- a/queue/zset/add.rb
+++ b/queue/zset/add.rb
@@ -17,8 +17,13 @@ x.push( "test 3" )
for i in 0 .. 10
x.each do |test|
- puts "adding #{test}"
- @redis.zadd('zset', Time.now.to_i, test)
+ @redis.watch('zset')
+ if (!(@redis.zscore("zset", test)))
+ res = @redis.multi do |r|
+ r.zadd('zset', Time.now.to_f * 10000000, test)
+ end
+ end
+ @redis.unwatch
end
sleep 1
end