mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
add db population
This commit is contained in:
parent
40ef4b6907
commit
d753cdb2f7
@ -76,11 +76,13 @@ puts "Ensuring profiling DB exists and is migrated"
|
|||||||
puts `bundle exec rake db:create`
|
puts `bundle exec rake db:create`
|
||||||
`bundle exec rake db:migrate`
|
`bundle exec rake db:migrate`
|
||||||
|
|
||||||
puts "Loading Rails"
|
puts "Timing loading Rails"
|
||||||
measure("load_rails") do
|
measure("load_rails") do
|
||||||
`bundle exec rake middleware`
|
`bundle exec rake middleware`
|
||||||
end
|
end
|
||||||
|
|
||||||
|
puts "Populating Profile DB"
|
||||||
|
run("bundle exec ruby script/profile_db_generator.rb")
|
||||||
|
|
||||||
begin
|
begin
|
||||||
pid = spawn("bundle exec thin start -p #{port}")
|
pid = spawn("bundle exec thin start -p #{port}")
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
# can be used to generate a mock db for profiling purposes
|
# can be used to generate a mock db for profiling purposes
|
||||||
|
|
||||||
|
# we want our script to generate a consistent output, to do so
|
||||||
|
# we monkey patch array sample so it always uses the same rng
|
||||||
|
class Array
|
||||||
|
RNG = Random.new(1098109928029800)
|
||||||
|
|
||||||
|
def sample
|
||||||
|
self[RNG.rand(size)]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# based on https://gist.github.com/zaius/2643079
|
# based on https://gist.github.com/zaius/2643079
|
||||||
def unbundled_require(gem)
|
def unbundled_require(gem)
|
||||||
if defined?(::Bundler)
|
if defined?(::Bundler)
|
||||||
@ -21,8 +32,9 @@ require 'optparse'
|
|||||||
begin
|
begin
|
||||||
unbundled_require 'gabbler'
|
unbundled_require 'gabbler'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
puts "please run: gem install gabller"
|
puts "installing gabbler gem"
|
||||||
exit
|
puts `gem install gabbler`
|
||||||
|
unbundled_require 'gabbler'
|
||||||
end
|
end
|
||||||
|
|
||||||
user_id = nil
|
user_id = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user