|
|
@ -52,14 +52,16 @@ module Mastodon |
|
|
|
|
|
|
|
progress.log("Processing #{item.id}") if options[:verbose] |
|
|
|
|
|
|
|
result = ActiveRecord::Base.connection_pool.with_connection do |
|
|
|
yield(item) |
|
|
|
ensure |
|
|
|
RedisConfiguration.pool.checkin if Thread.current[:redis] |
|
|
|
Thread.current[:redis] = nil |
|
|
|
Chewy.strategy(:mastodon) do |
|
|
|
result = ActiveRecord::Base.connection_pool.with_connection do |
|
|
|
yield(item) |
|
|
|
ensure |
|
|
|
RedisConfiguration.pool.checkin if Thread.current[:redis] |
|
|
|
Thread.current[:redis] = nil |
|
|
|
end |
|
|
|
|
|
|
|
aggregate.increment(result) if result.is_a?(Integer) |
|
|
|
end |
|
|
|
|
|
|
|
aggregate.increment(result) if result.is_a?(Integer) |
|
|
|
rescue => e |
|
|
|
progress.log pastel.red("Error processing #{item.id}: #{e}") |
|
|
|
ensure |
|
|
|