Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7bd674dd9b
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (19 sloc) 0.52 kb
require_relative 'queue'
module PersistentQueueClasses
module Redis
class SizedQueue < Queue
attr_accessor :max
def initialize(max, options={})
@max = max
super default_options.merge(options)
end
def push(obj)
redis.incr options[:waiting_key_name]
Thread.pass until length < max if length == max
bredis.rpush options[:queue_key_name], encode_object(obj)
ensure
redis.decr options[:waiting_key_name]
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.