gitlab-org--gitlab-foss/app/controllers
Andreas Brandl 53801b1206
Preload routes information
This fixes a high frequency N+1 issue:

`RoutableActions#find_routable!` is used across many controllers to
retrieve e.g. the Project or Namespace by path. The `#find_routable!`
method calls `#ensure_canonical_path` which in turn retrieves
`#full_path` from the given Routable.

This in turn triggers a lookup on `routes`, leading to a high frequency
of these queries:

```sql
SELECT  "routes".* FROM "routes" WHERE "routes"."source_id" = $1 AND
"routes"."source_type" = $2 LIMIT $3
```

This is unnecessary as we already join `routes` in
`Routable#find_by_full_path` anyways.
2019-09-03 12:16:03 +02:00
..
admin Preload routes information 2019-09-03 12:16:03 +02:00
boards
ci
clusters
concerns Merge branch 'fix-peek-on-puma' into 'master' 2019-09-02 08:43:21 +00:00
dashboard
explore
google_api
groups
import
instance_statistics
ldap
oauth
profiles
projects
sherlock
snippets
users
abuse_reports_controller.rb
acme_challenges_controller.rb
application_controller.rb
autocomplete_controller.rb
chaos_controller.rb
confirmations_controller.rb
dashboard_controller.rb
graphql_controller.rb
groups_controller.rb
health_check_controller.rb
health_controller.rb
help_controller.rb
ide_controller.rb
invites_controller.rb
jwt_controller.rb
metrics_controller.rb
notification_settings_controller.rb
omniauth_callbacks_controller.rb
passwords_controller.rb
profiles_controller.rb
projects_controller.rb
registrations_controller.rb
root_controller.rb
search_controller.rb
sent_notifications_controller.rb
sessions_controller.rb
snippets_controller.rb
uploads_controller.rb
user_callouts_controller.rb
users_controller.rb