Skip to content

Commit

Permalink
Let Rage connect to the DB
Browse files Browse the repository at this point in the history
  • Loading branch information
rsamoilov committed Sep 29, 2024
1 parent c32b9c9 commit 8951a29
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions frameworks/Ruby/rage/config/initializers/activerecord.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@

require "etc"

connection = {
adapter: "postgresql",
host: "tfb-database",
username: "benchmarkdbuser",
password: "benchmarkdbpass",
database: "hello_world",
reaping_frequency: 0,
pool: (2 * Math.log(256 / Etc.nprocessors)).floor
}
pool_size = (2 * Math.log(256 / Etc.nprocessors)).floor
puts "ActiveRecord pool size: #{pool_size}"

puts "ActiveRecord connection options: #{connection.inspect}"

ActiveRecord::Base.establish_connection(connection)
ENV["DATABASE_URL"]="postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world?pool=#{pool_size}&reaping_frequency=0"

0 comments on commit 8951a29

Please sign in to comment.