Browse Source

Fix crash in `tootctl` commands making use of parallelization when Elasticsearch is enabled (#24182)

closed-social-glitch-2
Claire 1 year ago
committed by GitHub
parent
commit
bdeb6ff180
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions
  1. +9
    -7
      lib/mastodon/cli_helper.rb

+ 9
- 7
lib/mastodon/cli_helper.rb View File

@ -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

Loading…
Cancel
Save