feat(worker): scale connection pool with worker threads

This will automatically increase the DB connection pool size if the number of threads needed in a worker is less than the maximum pool size configured.
This commit is contained in:
Adam Cooke
2024-03-18 08:12:42 +00:00
parent 7e2acccd1e
commit ea542a0694
3 changed files with 41 additions and 0 deletions
+6
View File
@@ -9,4 +9,10 @@ RSpec.describe Postal do
expect(Postal.signer.private_key.to_pem).to eq OpenSSL::PKey::RSA.new(File.read(Postal::Config.postal.signing_key_path)).to_pem
end
end
describe "#change_database_connection_pool_size" do
it "changes the connection pool size" do
expect { Postal.change_database_connection_pool_size(8) }.to change { ActiveRecord::Base.connection_pool.size }.from(5).to(8)
end
end
end