module Resque::Plugins::DisableJob
This class handles the main logic of the DisableJob
plugin. We can configure a job to be allowed to be disabled, set a job to be disabled or enable a job, and we can see the status of the currently disabled jobs.
Constants
- DEFAULT_TIMEOUT
- MAX_JOB_RULES
Public Instance Methods
before_perform_allow_disable_job(*args)
click to toggle source
# File lib/resque/plugins/disable_job.rb, line 17 def before_perform_allow_disable_job(*args) if Job.disabled?(name, args) disable_job_handler("Skipped running job #{name}(#{args})", args) end end
disable(specific_args = [], timeout = DEFAULT_TIMEOUT)
click to toggle source
# File lib/resque/plugins/disable_job.rb, line 28 def disable(specific_args = [], timeout = DEFAULT_TIMEOUT) Job.disable_job(name, specific_args: specific_args, timeout: timeout) end
disable_job_handler(message, *_args)
click to toggle source
Override this if you want custom processing
# File lib/resque/plugins/disable_job.rb, line 24 def disable_job_handler(message, *_args) raise Resque::Job::DontPerform, message end
enable(specific_args = [])
click to toggle source
# File lib/resque/plugins/disable_job.rb, line 32 def enable(specific_args = []) Job.enable_job(name, specific_args: specific_args) end
enable_all()
click to toggle source
# File lib/resque/plugins/disable_job.rb, line 36 def enable_all Job.enable_all(name) end