Sha256: b57d4162f2d12e827529320f07a6e8dfc3f00f0005c83f6e4249836a19a30c35
Contents?: true
Size: 1 KB
Versions: 14
Compression:
Stored size: 1 KB
Contents
# A queue of jobs class ActiveJob::Queue attr_reader :name def initialize(name, size: nil, active: nil, queue_adapter: ActiveJob::Base.queue_adapter) @name = name @queue_adapter = queue_adapter @size = size @active = active end def size @size ||= queue_adapter.queue_size(name) end alias length size def clear queue_adapter.clear_queue(name) end def empty? size == 0 end def pause queue_adapter.pause_queue(name) end def resume queue_adapter.resume_queue(name) end def paused? !active? end def active? return @active unless @active.nil? @active = !queue_adapter.queue_paused?(name) end # Return an +ActiveJob::JobsRelation+ with the pending jobs in the queue. def jobs ActiveJob::JobsRelation.new(queue_adapter: queue_adapter).pending.where(queue_name: name) end def reload @active = @size = nil self end def id name.parameterize end alias to_param id private attr_reader :queue_adapter end
Version data entries
14 entries across 14 versions & 1 rubygems