Class: RoundhouseUi::Demo::Base

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
lib/roundhouse_ui/demo.rb

Constant Summary collapse

DURATION =

Subclasses override. Milliseconds of work, and the chance of failing.

(100..400)
FAILURE_RATE =
0.0
ERRORS =
[ [ RuntimeError, "something went wrong" ] ].freeze

Instance Method Summary collapse

Instance Method Details

#perform(payload = {}) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/roundhouse_ui/demo.rb', line 33

def perform(payload = {})
  unless %w[development test].include?(ENV["RAILS_ENV"] || Rails.env.to_s)
    raise "RoundhouseUi::Demo workers do not run outside development"
  end

  work_for(self.class::DURATION)
  maybe_fail(payload)
end