Bug #18841

Avoid N+1 query in foreman hosts index by declaring proper scope

Added by Shimon Shtein 3 months ago. Updated about 1 month ago.

Status:ClosedSpent time:-
Assigned To:Shimon Shtein
Target version:Foreman - Team Ivan Iteration 12
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman_openscap/pull/247
Story points-
Velocity based estimate-
Releaseforeman_openscap 0.6.5Release relationshipAuto


Add this to plugin declaration:

  add_controller_action_scope(::Api::V2::HostsController, :index) do |base_scope|

Associated revisions

Revision 901f7787
Added by Shimon Shtein 2 months ago

Fixes #18841 - Added policies to hosts index api scope

Policies are loaded while calculating compliance status, to avoid
N+1 query we are preloading them.

Revision f1159c1f
Added by Ondřej Pražák 2 months ago

Merge pull request #247 from ShimShtein/18841

Fixes #18841 - Added policies to hosts index api scope


#1 Updated by Shimon Shtein 3 months ago

Add similar handling to UI hosts controller too.

#2 Updated by The Foreman Bot 3 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Shimon Shtein
  • Pull request https://github.com/theforeman/foreman_openscap/pull/247 added

#3 Updated by Shimon Shtein 2 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#4 Updated by Marek Hulán 2 months ago

  • Release set to foreman_openscap 0.6.5

#5 Updated by Ivan Necas 2 months ago

  • Target version set to Team Ivan Iteration 11

#6 Updated by Ivan Necas about 1 month ago

  • Target version changed from Team Ivan Iteration 11 to Team Ivan Iteration 12

Also available in: Atom PDF