Sha256: 1c076acdd7ff75df84367a53b66fbdc3c75af0311a1774ceeef81356996465bf

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

class BasicJob
  class_attribute :results
  self.results = Concurrent::Array.new

  def initialize(some_param: nil, sleep_time: 1)
    @some_param = some_param
    @sleep_time = sleep_time
  end

  def perform
    results << @some_param
    sleep @sleep_time if @sleep_time > 0
  end
end

class DbConnectionTestJob
  class_attribute :db_connections
  self.db_connections = Concurrent::Array.new

  def perform
    db_connections << ActiveRecord::Base.connection.object_id
  end
end

class FailingTestJob
  MESSAGE = 'I fail all the time'.freeze

  def perform
    fail MESSAGE
  end
end

class SyntaxErrorJob
  def perform
    fail SyntaxError
  end
end

class MemHungryJob
  class_attribute :data

  # Should consume roughly 1GB of memory.
  def perform
    self.class.data = 'x' * 250.megabytes
  end
end

class DummyRailsOpsOp
  class_attribute :results
  self.results = Concurrent::Array.new

  def self.run!(params = {})
    new(params).run!
  end

  def initialize(params = {})
    @params = params
  end

  def run!
    perform
  end

  private

  def perform
    results << @params
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
workhorse-1.2.24 test/lib/jobs.rb
workhorse-1.2.23 test/lib/jobs.rb
workhorse-1.2.22 test/lib/jobs.rb
workhorse-1.2.21 test/lib/jobs.rb
workhorse-1.2.20 test/lib/jobs.rb
workhorse-1.2.17 test/lib/jobs.rb
workhorse-1.2.17.rc2 test/lib/jobs.rb
workhorse-1.2.17.rc1 test/lib/jobs.rb