Sha256: e6a0c819ea5cb2c8900f488ffb6114a84081e8767d5b7046495374f5e468daf5

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

class StubJob
  include Sidekiq::Worker
  include Sidekiq::Status::Worker

  sidekiq_options 'retry' => 'false'

  def perform(*args)
  end
end

class LongJob < StubJob
  def perform(*args)
    sleep args[0] || 1
  end
end

class DataJob < StubJob
  def perform
    sleep 0.1
    store({data: 'meow'})
    retrieve(:data).should == 'meow'
    sleep 0.1
  end
end

class ProgressJob < StubJob
  def perform
    total 500
    at 100, 'howdy, partner?'
    sleep 0.1
  end
end

class ConfirmationJob < StubJob
  def perform(*args)
    Sidekiq.redis do |conn|
      conn.publish "job_messages_#{jid}", "while in #perform, status = #{conn.hget jid, :status}"
    end
  end
end

class NoStatusConfirmationJob
  include Sidekiq::Worker
  def perform(id)
    Sidekiq.redis do |conn|
      conn.set "NoStatusConfirmationJob_#{id}", "done"
    end
  end
end

class FailingJob < StubJob
  def perform
    raise StandardError
  end
end

class RetriedJob < StubJob
  sidekiq_options 'retry' => 'true'
  def perform()
    Sidekiq.redis do |conn|
      key = "RetriedJob_#{jid}"
      sleep 1
      unless conn.exists key
        conn.set key, 'tried'
        raise StandardError
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sidekiq-status-0.5.2 spec/support/test_jobs.rb
sidekiq-status-0.5.1 spec/support/test_jobs.rb
sidekiq-status-0.5.0 spec/support/test_jobs.rb