Sha256: 75e168ecb47821d9c17979b93f516adbc7cbb6949ec7b328c259912db0b3b2e2

Contents?: true

Size: 1.54 KB

Versions: 9

Compression:

Stored size: 1.54 KB

Contents

class ResponseForkingJob
  include Backburner::Queue
  queue_priority 1000
  def self.perform(data)
    $worker_test_count += data['worker_test_count'].to_i if data['worker_test_count']
    $worker_success = data['worker_success'] if data['worker_success']
    $worker_test_count = data['worker_test_count_set'].to_i if data['worker_test_count_set']
    $worker_raise = data['worker_raise'] if data['worker_raise']
  end
end

class TestJobForking
  include Backburner::Queue
  queue_priority 1000
  def self.perform(x, y)
    Backburner::Workers::Forking.enqueue ResponseForkingJob, [{
        :worker_test_count_set => x + y
    }], :queue => 'response'
  end
end

class TestFailJobForking
  include Backburner::Queue
  def self.perform(x, y)
    Backburner::Workers::Forking.enqueue ResponseForkingJob, [{
       :worker_raise => true
    }], :queue => 'response'
  end
end

class TestRetryJobForking
  include Backburner::Queue
  def self.perform(x, y)
    if $worker_test_count <= 2
      Backburner::Workers::Forking.enqueue ResponseForkingJob, [{
          :worker_test_count => 1
      }], :queue => 'response'

      raise RuntimeError
    else # succeeds
      Backburner::Workers::Forking.enqueue ResponseForkingJob, [{
          :worker_test_count => 1,
          :worker_success => true
      }], :queue => 'response'
    end
  end
end

class TestAsyncJobForking
  include Backburner::Performable
  def self.foo(x, y)
    Backburner::Workers::Forking.enqueue ResponseForkingJob, [{
        :worker_test_count_set => x * y
    }], :queue => 'response'
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
backburner-0.4.4 test/fixtures/test_forking_jobs.rb
backburner-0.4.3 test/fixtures/test_forking_jobs.rb
backburner-0.4.2 test/fixtures/test_forking_jobs.rb
backburner-0.4.1 test/fixtures/test_forking_jobs.rb
backburner-0.4.0 test/fixtures/test_forking_jobs.rb
backburner-0.3.4 test/fixtures/test_forking_jobs.rb
backburner-0.3.3 test/fixtures/test_forking_jobs.rb
backburner-0.3.2 test/fixtures/test_forking_jobs.rb
backburner-0.3.1 test/fixtures/test_forking_jobs.rb