summaryrefslogtreecommitdiff
path: root/lib/custodian/queue.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:47 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:47 +0000
commite716a49dabe2c086a97e2d8b3cffe5cf369ad026 (patch)
treee7e98125f89941db4c9d0f48f2df9c410467a3d8 /lib/custodian/queue.rb
parentaf2ee063abea8235a8cbd1448533e4f4fbc0d0af (diff)
Removed spaces inside parenthesis.
Diffstat (limited to 'lib/custodian/queue.rb')
-rw-r--r--lib/custodian/queue.rb22
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