lib/switchman/standard_error.rb in switchman-3.0.14 vs lib/switchman/standard_error.rb in switchman-3.0.15
- old
+ new
@@ -4,16 +4,17 @@
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
begin
- @active_shards = Shard.active_shards if defined?(Shard)
+ @active_shards ||= Shard.active_shards if defined?(Shard)
rescue
# If we hit an error really early in boot, activerecord may not be initialized yet
end
ensure
Thread.current[:switchman_error_handler] = nil