module Sqeduler::Worker::KillSwitch
Uses Redis hashes to enabled and disable workers across multiple hosts.
Constants
- SIDEKIQ_DISABLED_WORKERS
Public Class Methods
disabled()
click to toggle source
# File lib/sqeduler/worker/kill_switch.rb, line 15 def self.disabled Service.redis_pool.with do |redis| redis.hgetall(SIDEKIQ_DISABLED_WORKERS) end end
prepended(base)
click to toggle source
# File lib/sqeduler/worker/kill_switch.rb, line 8 def self.prepended(base) if base.ancestors.include?(Sqeduler::Worker::Callbacks) raise "Sqeduler::Worker::Callbacks must be the last module that you prepend." end base.extend(ClassMethods) end
Public Instance Methods
perform(*args)
click to toggle source
rubocop:enable Style/Documentation
Calls superclass method
# File lib/sqeduler/worker/kill_switch.rb, line 49 def perform(*args) if self.class.disabled? Service.logger.warn "#{self.class.name} is currently disabled." else super end end