mirror of https://github.com/tootsuite/mastodon
Fix crash in `tootctl` commands making use of parallelization when Elasticsearch is enabled (#24182)
parent
547634dfa6
commit
3d67a9329e
|
@ -53,14 +53,16 @@ module Mastodon
|
||||||
|
|
||||||
progress.log("Processing #{item.id}") if options[:verbose]
|
progress.log("Processing #{item.id}") if options[:verbose]
|
||||||
|
|
||||||
result = ActiveRecord::Base.connection_pool.with_connection do
|
Chewy.strategy(:mastodon) do
|
||||||
yield(item)
|
result = ActiveRecord::Base.connection_pool.with_connection do
|
||||||
ensure
|
yield(item)
|
||||||
RedisConfiguration.pool.checkin if Thread.current[:redis]
|
ensure
|
||||||
Thread.current[:redis] = nil
|
RedisConfiguration.pool.checkin if Thread.current[:redis]
|
||||||
end
|
Thread.current[:redis] = nil
|
||||||
|
end
|
||||||
|
|
||||||
aggregate.increment(result) if result.is_a?(Integer)
|
aggregate.increment(result) if result.is_a?(Integer)
|
||||||
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
progress.log pastel.red("Error processing #{item.id}: #{e}")
|
progress.log pastel.red("Error processing #{item.id}: #{e}")
|
||||||
ensure
|
ensure
|
||||||
|
|
Loading…
Reference in New Issue