switchman 1.5.17 → 1.5.18

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
  SHA1:
3
- metadata.gz: f304aef7570bb1f9343ea6d41b7128ff22adf401
4
- data.tar.gz: bbb189dda31a1ba8e286bbb880b39b493bd202cf
3
+ metadata.gz: 72cd0fd10611a4acc7c12f46ca25435689d9f3ea
4
+ data.tar.gz: 80a15da1b891e2945bf6c2ceb80c0bd95693d63f
5
5
  SHA512:
6
- metadata.gz: c5fd27c1f879019eefe1290c63f5d1353756f627810d80f1d6f506d0b48b7ff49765827e061d288d5bdd7a4d35d597ffb42c7931aaaa4429e4464cefb10644ee
7
- data.tar.gz: e863f8aa792c7324eb912b74d8c0ee4ebabd6184aa4eda77910e7726e9a6e37b34e90a718fc670a59eba6eb9860efb614eb021f64e53359d2e3cc03060a2cfeb
6
+ metadata.gz: 819f32885454df751e646e995b859b8ceb5549bb74f7f8e8dd4a0445c5423cb25ffccbf8dc84da32304f299e619469e9c1540af66537952751d5b3e31ee09384
7
+ data.tar.gz: a727cc6b22e0fb123adaf6514ccba6eb1330d9fa96e0410280bb063132852738f9dfe4d198caf271651ea4f0d6f7a1b0b23d20e7c5ec157e790cc6e59d484dba
@@ -86,6 +86,9 @@ module Switchman
86
86
  require "switchman/rails"
87
87
  require "switchman/shackles/relation"
88
88
  require "switchman/shard_internal"
89
+ require "switchman/standard_error"
90
+
91
+ ::StandardError.include(StandardError)
89
92
 
90
93
  include ActiveRecord::Base
91
94
  include ActiveRecord::AttributeMethods
@@ -0,0 +1,12 @@
1
+ module Switchman
2
+ module StandardError
3
+ def initialize(*args)
4
+ @active_shards = Shard.send(:active_shards).dup
5
+ super
6
+ end
7
+
8
+ def current_shard(category = :default)
9
+ @active_shards[category] || Shard.default
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.5.17"
2
+ VERSION = "1.5.18"
3
3
  end
@@ -56,15 +56,20 @@ module Switchman
56
56
  end
57
57
 
58
58
  ::Shackles.activate(:deploy) do
59
- Shard.with_each_shard(scope, Shard.categories, options) do
60
- shard = Shard.current
61
- puts "#{shard.id}: #{shard.description}"
62
- ::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name
63
- ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
64
- shard.database_server.unshackle do
65
- old_actions.each { |action| action.call(*task_args) }
59
+ begin
60
+ Shard.with_each_shard(scope, Shard.categories, options) do
61
+ shard = Shard.current
62
+ puts "#{shard.id}: #{shard.description}"
63
+ ::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name
64
+ ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
65
+ shard.database_server.unshackle do
66
+ old_actions.each { |action| action.call(*task_args) }
67
+ end
68
+ nil
66
69
  end
67
- nil
70
+ rescue => e
71
+ puts "Exception from #{e.current_shard.id}: #{e.current_shard.description}" if options[:parallel] != 0
72
+ raise
68
73
  end
69
74
  end
70
75
  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: 1.5.17
4
+ version: 1.5.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -202,6 +202,7 @@ files:
202
202
  - lib/switchman/shackles.rb
203
203
  - lib/switchman/shackles/relation.rb
204
204
  - lib/switchman/sharded_instrumenter.rb
205
+ - lib/switchman/standard_error.rb
205
206
  - lib/switchman/test_helper.rb
206
207
  - lib/switchman/version.rb
207
208
  - lib/tasks/switchman.rake