Class: Delayed::FailSafe::ClearLocks
- Inherits:
-
Plugin
- Object
- Plugin
- Delayed::FailSafe::ClearLocks
- Defined in:
- lib/delayed/fail_safe/clear_locks.rb
Constant Summary collapse
- @@exception_handler =
fail-safe by default
lambda do |ex, worker| # fail-safe by default worker.say "Error running clear_locks! callback: #{ex.inspect}", 'error' end
Class Method Summary collapse
- .call(worker) ⇒ Object
-
.exception_handler(&block) ⇒ Object
Allow user customizations of error handling.
Class Method Details
.call(worker) ⇒ Object
20 21 22 23 24 |
# File 'lib/delayed/fail_safe/clear_locks.rb', line 20 def self.call(worker) Delayed::Job.clear_locks!(worker.name) rescue => ex @@exception_handler.call(ex, worker) end |
.exception_handler(&block) ⇒ Object
Allow user customizations of error handling.
To get the same behavior as ‘Delayed::Plugins::ClearLocks` :
Delayed::FailSafe::ClearLocks.exception_handler { |ex| raise(ex) }
15 16 17 18 |
# File 'lib/delayed/fail_safe/clear_locks.rb', line 15 def self.exception_handler(&block) return @@exception_handler unless block_given? @@exception_handler = block end |