switchman 3.0.11 → 3.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49ec10390b095e34032d625e9a1540217c8d4361b7d0961d0f10218d2349ef6a
4
- data.tar.gz: 29f9748cbf4f1d4d268171ae7c0863d296b23788c8ee0153ee9cb32938933c03
3
+ metadata.gz: a1e19102ef71895fd381f6da856f98b71a44102fbbc08b9738f510c18fe198ed
4
+ data.tar.gz: acf67d407d42a2d32c617696f66000d358f4fbfbc7b12077e32945c07553853f
5
5
  SHA512:
6
- metadata.gz: c0c79ce80057b54bb0a7234d9ff09b7b9aa6af18c25b1b0c1b32365244ecb22332c90b2d477d537c24869ec84f9a1af06059e77e9f53a21c2391164df7758338
7
- data.tar.gz: 7e335d49f3e8e44eb1d2ea1061dd837ceffb5a7505c7d2dbefe11c5bea2ba290bf0795b0f74a938bedd2e79f69dda03bd2da62ffabe8f6f8771da5053007a073
6
+ metadata.gz: 9fad637185836ac6f213b6bd61870fd3390a0f10f66d74fcb0c913977e6c5d394cfee57ceab430800dc0b96a43508f131864b1aad4fb037bea861166fed30dd5
7
+ data.tar.gz: 6f3592f8ed5a920a9e556fd0a888ac59ce17ca144f85a3d78077f6a3ab036ec385f7e7070b08fd0db9de93fd54f408315837fc97e118229259e43147b017aae7
@@ -3,20 +3,22 @@
3
3
  module Switchman
4
4
  module StandardError
5
5
  def initialize(*args)
6
- # Shard.current can throw this when switchman isn't working right; if we try to
7
- # do our stuff here, it'll cause a SystemStackError, which is a pain to deal with
8
- if is_a?(::ActiveRecord::ConnectionNotEstablished)
9
- super
10
- return
11
- end
6
+ super
7
+ # These seem to get themselves into a bad state if we try to lookup shards while processing
8
+ return if is_a?(IO::EAGAINWaitReadable)
9
+ return if Thread.current[:switchman_error_handler]
12
10
 
13
11
  begin
14
- @active_shards = Shard.active_shards if defined?(Shard)
15
- rescue ::ActiveRecord::ConnectionNotEstablished
16
- # If we hit an error really early in boot, activerecord may not be initialized yet
17
- end
12
+ Thread.current[:switchman_error_handler] = true
18
13
 
19
- super
14
+ begin
15
+ @active_shards = Shard.active_shards if defined?(Shard)
16
+ rescue
17
+ # If we hit an error really early in boot, activerecord may not be initialized yet
18
+ end
19
+ ensure
20
+ Thread.current[:switchman_error_handler] = nil
21
+ end
20
22
  end
21
23
 
22
24
  def current_shard(klass = ::ActiveRecord::Base)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = '3.0.11'
4
+ VERSION = '3.0.12'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.11
4
+ version: 3.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer