Created
June 12, 2011 01:01
-
-
Save arockwell/1021135 to your computer and use it in GitHub Desktop.
Clock for pushing tasks to redis periodicall
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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