]> cat aescling's git repositories - mastodon.git/commitdiff
Fix how to change connection pool for rails 6 (#16158)
authorTakeshi Umeda <noel.yoshiba@gmail.com>
Wed, 5 May 2021 02:41:10 +0000 (11:41 +0900)
committerGitHub <noreply@github.com>
Wed, 5 May 2021 02:41:10 +0000 (04:41 +0200)
* Fix how to change connection pool for rails 6

* Fix to match the code elsewhere

lib/mastodon/search_cli.rb

index 22a0acec80e992f376ddf0d1c085488c81bf8a5a..c0491744bcf74ec7955d293d6c4b4a79ae710a17 100644 (file)
@@ -53,7 +53,9 @@ module Mastodon
         index.specification.lock!
       end
 
-      ActiveRecord::Base.configurations[Rails.env]['pool'] = options[:concurrency] + 1
+      db_config = ActiveRecord::Base.configurations[Rails.env].dup
+      db_config['pool'] = options[:concurrency] + 1
+      ActiveRecord::Base.establish_connection(db_config)
 
       pool    = Concurrent::FixedThreadPool.new(options[:concurrency])
       added   = Concurrent::AtomicFixnum.new(0)