class AsyncExperiments::ExperimentResultControlWorker

Constants

LOCK_TIMEOUT

Public Instance Methods

perform(name, id, run_output, duration, expiry, allowed_attempts = 5, attempt = 1) click to toggle source
# File lib/async_experiments/experiment_result_control_worker.rb, line 11
def perform(name, id, run_output, duration, expiry, allowed_attempts = 5, attempt = 1)
  Sidekiq.redis do |redis|
    result = ExperimentResult.new(name, id, :control, redis, statsd, run_output, duration)
    candidate = ExperimentResult.new(name, id, :candidate, redis, statsd)
    if candidate.available?
      result.process_run_output(candidate, expiry)
    elsif allowed_attempts > attempt
      self.class.perform_in(5, name, id, run_output, duration, expiry, allowed_attempts, attempt + 1)
    end
  end
end

Private Instance Methods

statsd() click to toggle source
# File lib/async_experiments/experiment_result_control_worker.rb, line 25
def statsd
  AsyncExperiments.statsd
end