Actions
Bug #12621
closedExcessive TemplateKind DB queries when retrieving API docs
Description
When viewing uncached API docs (e.g. /apidoc/v2/hosts.html), there are loads of DB queries for TemplateKinds:
2015-11-27T09:50:41 [sql] [D] TemplateKind Load (0.1ms) SELECT "template_kinds".* FROM "template_kinds"
2015-11-27T09:50:41 [sql] [D] TemplateKind Load (0.1ms) SELECT "template_kinds".* FROM "template_kinds"
2015-11-27T09:50:41 [sql] [D] TemplateKind Load (0.1ms) SELECT "template_kinds".* FROM "template_kinds"
2015-11-27T09:50:41 [sql] [D] TemplateKind Load (0.1ms) SELECT "template_kinds".* FROM "template_kinds"
2015-11-27T09:50:41 [sql] [D] TemplateKind Load (0.1ms) SELECT "template_kinds".* FROM "template_kinds"
2015-11-27T09:50:41 [sql] [D] TemplateKind Load (0.1ms) SELECT "template_kinds".* FROM "template_kinds"
2015-11-27T09:50:41 [sql] [D] TemplateKind Load (0.1ms) SELECT "template_kinds".* FROM "template_kinds"
2015-11-27T09:50:41 [sql] [D] TemplateKind Load (0.1ms) SELECT "template_kinds".* FROM "template_kinds"
2015-11-27T09:50:41 [sql] [D] TemplateKind Load (0.1ms) SELECT "template_kinds".* FROM "template_kinds"
This is because of my bad recommendation to query it on the fly in config/initializers/apipie.rb during #11643.
Perhaps to fix it we'll need to remove it again from the lambda but simply fail safely when the table isn't set up?
Updated by Dominic Cleal about 9 years ago
- Related to Feature #11643: Allow through API methods to render templates without configuring a host in build mode added
Updated by Tom Caspy almost 9 years ago
don't think it's in config/initializers/apipie.rb, the only thing which does a similar thing there is TemplateKind.pluck(:name) which generates a SELECT "template_kinds"."name" FROM "template_kinds" query, not a select * from
will investigate further
Updated by The Foreman Bot almost 9 years ago
- Status changed from New to Ready For Testing
- Assignee set to Tom Caspy
- Pull request https://github.com/theforeman/foreman/pull/3138 added
Updated by Tom Caspy almost 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 44ad385e0b64bd38feac0c1a0211e5ff7db05441.
Actions