diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:19:47 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:19:47 +0000 |
commit | 54b21cf54c51dfe40784a8096f84c7a80b015bd4 (patch) | |
tree | 4763692624732650daf1a9e02c91576d3f7ee8d0 /lib/custodian/queue.rb | |
parent | a22b8e96ead33b0f97ed5243dbad7f7b6cd5135d (diff) |
Removed spaces inside parenthesis.
Diffstat (limited to 'lib/custodian/queue.rb')
-rw-r--r-- | lib/custodian/queue.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/custodian/queue.rb b/lib/custodian/queue.rb index 12db68d..4517c61 100644 --- a/lib/custodian/queue.rb +++ b/lib/custodian/queue.rb @@ -6,7 +6,7 @@ begin require library rescue LoadError - ENV['DEBUG'] && puts( "Failed to load the library: #{library}" ) + ENV['DEBUG'] && puts("Failed to load the library: #{library}") end end @@ -81,7 +81,7 @@ end # def initialize host = ENV['QUEUE_ADDRESS'] || '127.0.0.1' - @redis = Redis.new( :host => host ) + @redis = Redis.new(:host => host) end @@ -94,14 +94,14 @@ end def fetch(timeout = 1) job = nil - while( true ) + while(true) - foo, job = @redis.blpop( 'queue', :timeout => timeout ) + foo, job = @redis.blpop('queue', :timeout => timeout) if job return job else - sleep( timeout ) + sleep(timeout) end end @@ -112,7 +112,7 @@ end # Add a new job to the queue. # def add(job_string) - @redis.rpush( 'queue', job_string ) + @redis.rpush('queue', job_string) end @@ -120,7 +120,7 @@ end # How many jobs in the queue? # def size? - @redis.llen( 'queue' ) + @redis.llen('queue') end @@ -128,7 +128,7 @@ end # Empty the queue, discarding all pending jobs. # def flush! - @redis.del( 'queue' ) + @redis.del('queue') end end @@ -145,7 +145,7 @@ end # def initialize host = ENV['QUEUE_ADDRESS'] || '127.0.0.1' - @queue = Beanstalk::Pool.new( ["#{host}:11300" ] ) + @queue = Beanstalk::Pool.new(["#{host}:11300" ]) end @@ -183,7 +183,7 @@ end # def size? stats = @queue.stats - ( stats['current-jobs-ready'] || 0 ) + (stats['current-jobs-ready'] || 0) end @@ -191,7 +191,7 @@ end # Flush the queue, discarding all pending jobs. # def flush! - while( fetch(1) ) + while(fetch(1)) # nop end end |