Module: Unrestful::Utils
- Included in:
- JobsController
- Defined in:
- lib/unrestful/utils.rb
Instance Method Summary collapse
Instance Method Details
#safe_thread(name, &block) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/unrestful/utils.rb', line 11 def safe_thread(name, &block) Thread.new do Thread.current['unrestful_name'.freeze] = name watchdog(name, &block) end end |
#watchdog(last_words) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/unrestful/utils.rb', line 4 def watchdog(last_words) yield rescue Exception => exc Rails.logger.debug "#{last_words}: #{exc}" #raise exc end |