Sha256: d7ce0af166b39be0c15147a6c529e8c1cf4c28e14b2e927032945e9c38cc4056
Contents?: true
Size: 755 Bytes
Versions: 3
Compression:
Stored size: 755 Bytes
Contents
# frozen_string_literal: true module Switchman module StandardError def initialize(*args) super # These seem to get themselves into a bad state if we try to lookup shards while processing return if is_a?(IO::EAGAINWaitReadable) return if Thread.current[:switchman_error_handler] begin Thread.current[:switchman_error_handler] = true @active_shards ||= Shard.active_shards rescue ThreadError # e.g. `require': can't be called from trap context (ThreadError) # intentionally empty ensure Thread.current[:switchman_error_handler] = nil end end def current_shard(klass = ::ActiveRecord::Base) @active_shards&.[](klass) || Shard.default end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
switchman-3.5.9 | lib/switchman/standard_error.rb |
switchman-3.5.8 | lib/switchman/standard_error.rb |
switchman-3.5.7 | lib/switchman/standard_error.rb |