class SwitchGearSidekiq::Breaker
Attributes
worker[RW]
Public Class Methods
new() { |self| ... }
click to toggle source
# File lib/switch_gear_sidekiq/breaker.rb, line 6 def initialize yield self @namespace = "circuit_breaker_#{worker}" @logger = logger || Sidekiq.logger # dummy lambda to allow easy invocation of job @circuit = circuit || -> (sk_job) { sk_job.call } run_validations end
Public Instance Methods
to_s()
click to toggle source
# File lib/switch_gear_sidekiq/breaker.rb, line 15 def to_s <<~EOF [SwitchGearSidekiq::Breaker] - Breaker config namespace: #{namespace} logger: #{logger} circuit: #{circuit} reset_timeout: #{reset_timeout} failure_limit: #{failure_limit} EOF end
Private Instance Methods
run_validations()
click to toggle source
# File lib/switch_gear_sidekiq/breaker.rb, line 28 def run_validations msg = "please provider a worker" raise(ArgumentError, msg) if !worker end