Skip to content

Commit 8951a29

Browse files
committed
Let Rage connect to the DB
1 parent c32b9c9 commit 8951a29

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

frameworks/Ruby/rage/config/initializers/activerecord.rb

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,7 @@
22

33
require "etc"
44

5-
connection = {
6-
adapter: "postgresql",
7-
host: "tfb-database",
8-
username: "benchmarkdbuser",
9-
password: "benchmarkdbpass",
10-
database: "hello_world",
11-
reaping_frequency: 0,
12-
pool: (2 * Math.log(256 / Etc.nprocessors)).floor
13-
}
5+
pool_size = (2 * Math.log(256 / Etc.nprocessors)).floor
6+
puts "ActiveRecord pool size: #{pool_size}"
147

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

0 commit comments

Comments
 (0)