lib/tasks/switchman.rake in switchman-1.5.17 vs lib/tasks/switchman.rake in switchman-1.5.18

- old
+ new

@@ -54,18 +54,23 @@ require 'switchman/test_helper' TestHelper.recreate_persistent_test_shards(dont_create: true) end ::Shackles.activate(:deploy) do - Shard.with_each_shard(scope, Shard.categories, options) do - shard = Shard.current - puts "#{shard.id}: #{shard.description}" - ::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name - ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys - shard.database_server.unshackle do - old_actions.each { |action| action.call(*task_args) } + begin + Shard.with_each_shard(scope, Shard.categories, options) do + shard = Shard.current + puts "#{shard.id}: #{shard.description}" + ::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name + ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys + shard.database_server.unshackle do + old_actions.each { |action| action.call(*task_args) } + end + nil end - nil + rescue => e + puts "Exception from #{e.current_shard.id}: #{e.current_shard.description}" if options[:parallel] != 0 + raise end end end end