Project

General

Profile

Actions

Bug #12621

closed

Excessive TemplateKind DB queries when retrieving API docs

Added by Dominic Cleal over 8 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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?


Related issues 1 (0 open1 closed)

Related to Foreman - Feature #11643: Allow through API methods to render templates without configuring a host in build modeClosedShlomi Zadok09/01/2015Actions
Actions

Also available in: Atom PDF