Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Avoid logging slow SQL for tenant creation

Christophe Bliardb3992d969865
diff --git a/config/initializers/log_slow_sql_queries.rb b/config/initializers/log_slow_sql_queries.rb
index 53addff265f..6bd3f31882e 100644
--- a/config/initializers/log_slow_sql_queries.rb
+++ b/config/initializers/log_slow_sql_queries.rb
@@ -42,6 +42,9 @@ Rails.application.configure do
# Skip transaction that may be blocked
next if data[:sql].match?(/BEGIN|COMMIT/)
+ # Skip tenant creation (load dump)
+ next if data[:sql][..120].include?("Dumped by pg_dump")
+
# Skip smaller durations
duration = ((finish - start) * 1000).round(4)
next if duration <= slow_sql_threshold