summaryrefslogtreecommitdiff
path: root/queue/zset/add.rb
diff options
context:
space:
mode:
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