aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/referential.rb
diff options
context:
space:
mode:
authorTeddy Wing2017-12-11 14:22:22 +0100
committerTeddy Wing2017-12-11 14:22:22 +0100
commitb72e4dee4766b6cf310634ff404caf589c917349 (patch)
tree494ab0e92529db98cde77ff1211a4f2a499066e4 /app/models/referential.rb
parentf858a1b3b446b973247fc1e9a44b2099f0b31c38 (diff)
downloadchouette-core-b72e4dee4766b6cf310634ff404caf589c917349.tar.bz2
Referential#create_schema: Log benchmark time to create
We want some measurements for how long it takes to create schemas to give us some data to decide whether to put `#create_schema` in an `after_commit` somehow (it didn't work the simple way). This at least gives us a better idea of what's going on and how our table lock is performing. Refs #5024
Diffstat (limited to 'app/models/referential.rb')
-rw-r--r--app/models/referential.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/referential.rb b/app/models/referential.rb
index 81bb1d6d5..b14ab3827 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -293,7 +293,11 @@ class Referential < ActiveRecord::Base
def create_schema
unless created_from
- Apartment::Tenant.create slug
+ report = Benchmark.measure do
+ Apartment::Tenant.create slug
+ end
+
+ Rails.logger.info("Schema create benchmark: '#{slug}'\t#{report}")
Rails.logger.error( "Schema migrations count for Referential #{slug} " + Referential.connection.select_value("select count(*) from #{slug}.schema_migrations;").to_s )
end
end