Sha256: 7338d5b5f88bc586689744d16c4bb60859be7946612ed559d9335baa54e3b533

Contents?: true

Size: 490 Bytes

Versions: 3

Compression:

Stored size: 490 Bytes

Contents

module ModernTimes
  class Thread < ::Thread
    def initialize(&block)
      super() do
        begin
          yield
        rescue => e
          ModernTimes.logger.fatal("Thread #{self} died due to exception #{e.message}\n#{e.backtrace.join("\n")}")
        ensure
          ActiveRecord::Base.clear_active_connections!() if Module.const_get('ActiveRecord') rescue nil
          ModernTimes.logger.flush if ModernTimes.logger.respond_to?(:flush)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
modern_times-0.1.2 lib/modern_times/thread.rb
modern_times-0.1.1 lib/modern_times/thread.rb
modern_times-0.1.0 lib/modern_times/thread.rb