summaryrefslogtreecommitdiff
path: root/queue/zset/run.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2016-01-18 14:16:07 +0200
committerSteve Kemp <steve@steve.org.uk>2016-01-18 14:16:07 +0200
commitc6f2c6f924e6b263be5a3ba4a4eb7049f27544d3 (patch)
treee023f6bbef8a2ecf8829a0d0ab5214b902266bc7 /queue/zset/run.rb
parentfbd4e3bf99afbc80012d6dc029be19e1bd8e6890 (diff)
Removed queue-examples.
These are no longer required now we're sure we understand the process of adding jobs to the queue without duplication.
Diffstat (limited to 'queue/zset/run.rb')
-rwxr-xr-xqueue/zset/run.rb45
1 files changed, 0 insertions, 45 deletions
diff --git a/queue/zset/run.rb b/queue/zset/run.rb
deleted file mode 100755
index b6990ff..0000000
--- a/queue/zset/run.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/ruby
-
-require "redis"
-require 'pp'
-@redis = Redis.new(:host => "127.0.0.1")
-
-
-
-def fetch(timeout = 1)
- job = nil
-
- loop do
- job = @redis.ZRANGE('zset', '0', '0')
-
- if !job.empty?
- # We only have one entry in our array
- job = job[0]
-
- # Remove from the queue
- @redis.zrem('zset', job );
-
- return job
- else
- sleep(timeout)
- end
-
- end
-end
-
-seen = []
-
-while( x = fetch() )
- puts "Got job : #{x}"
- if seen.include?(x)
- puts "Already seen #{x}"
- break
- end
-
- seen << x
-
- if ( x =~ /test 2/i )
- puts "TEST 2 - sleeping"
- sleep 5
- end
-end