lib/afterparty/queue.rb in afterparty-0.1.1 vs lib/afterparty/queue.rb in afterparty-0.2.0

- old
+ new

@@ -2,40 +2,22 @@ class Queue attr_accessor :options, :temp_namespace, :login_block include Afterparty::QueueHelpers def push job - # @mutex.synchronize do - return nil if job.nil? - queue_name = @temp_namespace || @options[:namespace] - AfterpartyJob.make_with_job job, queue_name - # end + return nil if job.nil? + AfterpartyJob.make_with_job job, @options[:namespace] end alias :<< :push alias :eng :push def pop - # @mutex.synchronize do - while true do - unless (_job = AfterpartyJob.valid.first).nil? - _job.save - return _job - end - sleep(@options[:sleep]) + while true do + unless (_job = next_valid_job).nil? + _job.save + return _job end - # end - end - end - - class TestQueue < Queue - attr_accessor :completed_jobs - - def initialize opts={} - super - @completed_jobs = [] - @exceptions = [] - end - def handle_exception job, exception - @exceptions << [job, exception] + sleep(@options[:sleep]) + end end end end \ No newline at end of file