Skip to content

Instantly share code, notes, and snippets.

@arockwell
Created June 12, 2011 01:01
Show Gist options
  • Select an option

  • Save arockwell/1021135 to your computer and use it in GitHub Desktop.

Select an option

Save arockwell/1021135 to your computer and use it in GitHub Desktop.
Clock for pushing tasks to redis periodicall
redis = Redis.new(:host => redis_host, :port => redis_port)
while(1) do
first_url = redis.rpoplpush src_queue, src_queue
redis.rpush work_queue, first_url
while(1) do
next_url = redis.rpoplpush src_queue, src_queue
if next_url != first_url
redis.rpush work_queue, next_url
else
break
end
sleep sleep_interval
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment