module FastlyNsq::SafeThread
Public Instance Methods
safe_thread(name, &block)
click to toggle source
# File lib/fastly_nsq/safe_thread.rb, line 4 def safe_thread(name, &block) Thread.new do Thread.current['fastly_nsq_label'] = name watchdog(name, &block) end end
watchdog(last_words) { || ... }
click to toggle source
# File lib/fastly_nsq/safe_thread.rb, line 11 def watchdog(last_words) yield rescue => e FastlyNsq.logger.error e FastlyNsq.logger.error last_words FastlyNsq.logger.error e.backtrace.join("\n") unless e.backtrace.nil? raise e end